From bb7542e254d873e7b816556cb9caab3bccce7758 Mon Sep 17 00:00:00 2001
From: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>
Date: Wed, 30 Jul 2025 08:41:32 +0100
Subject: [PATCH] chore(ci): Remove Gitversion (#369)
* Strip out gitversion
* Pr workflow
* fix?
* fix x2
* pass envvars properly
---
.config/dotnet-tools.json | 9 +--------
.github/workflows/pr.yml | 20 +++++++++++++++++---
.github/workflows/release.yml | 29 +++++++++++++++++++++++------
GitVersion.yml | 6 ------
Speckle.Sdk.sln | 1 -
Speckle.Sdk.slnx | 3 +--
build/Program.cs | 18 ++++++++----------
7 files changed, 50 insertions(+), 36 deletions(-)
delete mode 100644 GitVersion.yml
diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index bc24e52d..9c4df592 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -8,13 +8,6 @@
"csharpier"
],
"rollForward": false
- },
- "gitversion.tool": {
- "version": "6.1.0",
- "commands": [
- "dotnet-gitversion"
- ],
- "rollForward": false
}
}
-}
\ No newline at end of file
+}
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index f4afe4ea..b0b63684 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -9,8 +9,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- with:
- fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
@@ -21,9 +19,25 @@ jobs:
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
-
+
+ - id: set-version
+ name: Set version to output
+ run: |
+ SEMVER="3.0.99.${{ github.run_number }}"
+ FILE_VERSION=$(echo "$SEMVER" | sed -E 's/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
+ FILE_VERSION="$FILE_VERSION.${{ github.run_number }}"
+
+ echo "semver=$SEMVER" >> "$GITHUB_OUTPUT"
+ echo "fileVersion=$FILE_VERSION" >> "$GITHUB_OUTPUT"
+
+ echo $SEMVER
+ echo $FILE_VERSION
+
- name: 🔫 Build All
run: ./build.sh
+ env:
+ SEMVER: ${{ steps.set-version.outputs.SEMVER }}
+ FILE_VERSION: ${{ steps.set-version.outputs.FILE_VERSION }}
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 0ad4a0e9..590b0ead 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -2,7 +2,6 @@ name: .NET Build and Publish
on:
push:
- branches: ["main", "dev"]
tags: ["3.*"]
jobs:
@@ -11,22 +10,40 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- with:
- fetch-depth: 0
-
+
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x.x
-
+
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
+
+ - id: set-version
+ name: Set version to output
+ run: |
+ TAG=${{ github.ref_name }}
+ if [[ "${{ github.ref }}" != refs/tags/* ]]; then
+ TAG="3.0.99.${{ github.run_number }}"
+ fi
+ SEMVER="${TAG}"
+ FILE_VERSION=$(echo "$TAG" | sed -E 's/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
+ FILE_VERSION="$FILE_VERSION.${{ github.run_number }}"
+
+ echo "semver=$SEMVER" >> "$GITHUB_OUTPUT"
+ echo "fileVersion=$FILE_VERSION" >> "$GITHUB_OUTPUT"
+
+ echo $SEMVER
+ echo $FILE_VERSION
- name: 🔫 Build and Pack
run: ./build.sh pack
-
+ env:
+ SEMVER: ${{ steps.set-version.outputs.SEMVER }}
+ FILE_VERSION: ${{ steps.set-version.outputs.FILE_VERSION }}
+
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
with:
diff --git a/GitVersion.yml b/GitVersion.yml
deleted file mode 100644
index cc61f149..00000000
--- a/GitVersion.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-workflow: GitFlow/v1
-next-version: 3.0.0
-branches:
- main:
- prevent-increment:
- when-current-commit-tagged: true
diff --git a/Speckle.Sdk.sln b/Speckle.Sdk.sln
index 410fe887..b5b2b15d 100644
--- a/Speckle.Sdk.sln
+++ b/Speckle.Sdk.sln
@@ -23,7 +23,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{DA2AED
Directory.Packages.props = Directory.Packages.props
global.json = global.json
README.md = README.md
- GitVersion.yml = GitVersion.yml
docker-compose.yml = docker-compose.yml
CodeMetricsConfig.txt = CodeMetricsConfig.txt
Directory.Build.Targets = Directory.Build.Targets
diff --git a/Speckle.Sdk.slnx b/Speckle.Sdk.slnx
index 2c9c17ff..aee97c65 100644
--- a/Speckle.Sdk.slnx
+++ b/Speckle.Sdk.slnx
@@ -11,7 +11,6 @@
-
@@ -43,4 +42,4 @@
-
\ No newline at end of file
+
diff --git a/build/Program.cs b/build/Program.cs
index 5b3e2798..485f92c4 100644
--- a/build/Program.cs
+++ b/build/Program.cs
@@ -1,4 +1,3 @@
-using System.Text.Json;
using GlobExpressions;
using static Bullseye.Targets;
using static SimpleExec.Command;
@@ -16,14 +15,13 @@ const string CLEAN_LOCKS = "clean-locks";
const string PERF = "perf";
const string DEEP_CLEAN = "deep-clean";
-static async Task<(string, string)> GetVersions()
+static (string semver, string fileVerison) GetVersions()
{
- var (output, _) = await ReadAsync("dotnet", "dotnet-gitversion /output json").ConfigureAwait(false);
- output = output.Trim();
- var jDoc = JsonDocument.Parse(output);
- var version = jDoc.RootElement.GetProperty("FullSemVer").GetString() ?? "3.0.0-localBuild";
- var fileVersion = jDoc.RootElement.GetProperty("AssemblySemFileVer").GetString() ?? "3.0.0.0";
- return (version, fileVersion);
+ string semver =
+ Environment.GetEnvironmentVariable("SEMVER") ?? throw new ArgumentException("Expected SEMVER env var");
+ string fileVersion =
+ Environment.GetEnvironmentVariable("FILE_VERSION") ?? throw new ArgumentException("Expected FILE_VERSION env var");
+ return (semver, fileVersion);
}
Target(
@@ -77,7 +75,7 @@ Target(
dependsOn: [RESTORE],
async () =>
{
- var (version, fileVersion) = await GetVersions().ConfigureAwait(false);
+ var (version, fileVersion) = GetVersions();
Console.WriteLine($"Version: {version} & {fileVersion}");
await RunAsync(
"dotnet",
@@ -174,7 +172,7 @@ Target(
async () =>
{
{
- var (version, fileVersion) = await GetVersions().ConfigureAwait(false);
+ var (version, fileVersion) = GetVersions();
Console.WriteLine($"Version: {version} & {fileVersion}");
await RunAsync("dotnet", $"pack Speckle.Sdk.sln -c Release -o output --no-build -p:Version={version}")
.ConfigureAwait(false);