diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml
index 9933820..e55e0e2 100644
--- a/.github/workflows/github-actions.yml
+++ b/.github/workflows/github-actions.yml
@@ -1,6 +1,9 @@
name: Alma build
-on: [push]
+on:
+ push:
+ tags:
+ - "v*"
jobs:
build:
@@ -26,6 +29,7 @@ jobs:
dotnet-version: '7.0.x'
- name: Patch version
run: ${{ matrix.target.version_script }}
+ continue-on-error: true
- name: Restore dependencies
run: dotnet restore src/Alma
- name: Build
diff --git a/.scripts/versioning.ps1 b/.scripts/versioning.ps1
index c39b3f9..e44e44a 100644
--- a/.scripts/versioning.ps1
+++ b/.scripts/versioning.ps1
@@ -1 +1,15 @@
-gci env:\
\ No newline at end of file
+gci env:\
+
+if((Get-Content env:\GITHUB_REF_TYPE) -ne "tag")
+{
+ Return
+}
+
+$version = (Get-Content env:\GITHUB_REF).Replace("refs/tags/v", "")
+$git_sha = (Get-Content env:\GITHUB_SHA).Substring(0, 8)
+
+Write-Host $version
+Write-Host $git_sha
+
+(Get-Content src\Alma\Alma.csproj).Replace("0.0.0", $version).Replace("development", $git_sha) | Set-Content src\Alma\Alma.csproj
+Write-Host (Get-Content src\Alma\Alma.csproj)
\ No newline at end of file
diff --git a/.scripts/versioning.sh b/.scripts/versioning.sh
index abefac4..a72aa94 100755
--- a/.scripts/versioning.sh
+++ b/.scripts/versioning.sh
@@ -1 +1,16 @@
-printenv
\ No newline at end of file
+printenv
+
+if [ ${GITHUB_REF_TYPE} != "tag" ]; then
+ exit 1
+fi
+
+version="${GITHUB_REF:11}"
+git_hash="${GITHUB_SHA}"
+echo $git_hash
+git_hash=`expr substr $git_hash 1 8`
+
+echo $version
+echo $git_hash
+
+sed -i "s/0.0.0/$version/g;s/development/$git_hash/g" src/Alma/Alma.csproj
+cat src/Alma/Alma.csproj
\ No newline at end of file
diff --git a/src/Alma/Alma.csproj b/src/Alma/Alma.csproj
index fe29fbe..f858dcc 100644
--- a/src/Alma/Alma.csproj
+++ b/src/Alma/Alma.csproj
@@ -14,6 +14,8 @@
net7.0
enable
enable
+ 0.0.0
+ development