We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ae488a commit 0c828d4Copy full SHA for 0c828d4
.github/workflows/build.yml
@@ -4,6 +4,8 @@ on:
4
push:
5
branches:
6
- main
7
+ tags:
8
+ - 'v[0-9]+.[0-9]+.[0-9]+'
9
pull_request:
10
11
@@ -27,13 +29,16 @@ jobs:
27
29
id: get_version
28
30
shell: pwsh
31
run: |
- # Set version
- $TAG = (git describe --tags --exact-match 2>$null) -or ""
32
+ $TAG = if ($env:GITHUB_REF -like "refs/tags/v*") {
33
+ $env:GITHUB_REF -replace 'refs/tags/v', ''
34
+ } else {
35
+ ""
36
+ }
37
- if ($TAG -like "v*") {
- # Remove the 'v' prefix
- $VERSION = $TAG.Substring(1)
38
+ if ($TAG -ne "") {
39
+ $VERSION = $TAG
40
} else {
41
+ # Fallback to commit hash if no tag
42
$COMMIT_HASH = git rev-parse --short HEAD
43
$VERSION = "0.0.1-$COMMIT_HASH"
44
}
0 commit comments