Skip to content

Commit b25d41e

Browse files
committed
ci: fix build scripts to handle multi-tags
1 parent 7430f37 commit b25d41e

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

.github/workflows/release-docker.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ jobs:
2121

2222
- name: Get tag
2323
id: get_tag
24-
run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
24+
run: git describe --tags --always --match 'v*'
25+
outputs:
26+
tag: ${{ steps.get_tag.outputs.tag }}
2527

2628
- name: Set up QEMU
2729
uses: docker/setup-qemu-action@v2

Taskfile.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tasks:
1313
label: build-{{.TASK}}
1414
vars:
1515
BUILD_VERSION:
16-
sh: git describe --tags
16+
sh: git describe --tags --always --match 'v*'
1717
BUILD_COMMIT:
1818
sh: git rev-parse HEAD
1919
BUILD_DATE:

build.ps1

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ function PlatformToEnv($os, $arch) {
99
$env:CGO_ENABLED = 0
1010
$env:GOOS = $os
1111
$env:GOARCH = $arch
12-
12+
1313
switch -Regex ($arch) {
14-
"arm" {
14+
"arm" {
1515
$env:GOARM = "7"
1616
}
17-
"armv5" {
17+
"armv5" {
1818
$env:GOARM = "5"
1919
$env:GOARCH = "arm"
2020
}
21-
"armv6" {
21+
"armv6" {
2222
$env:GOARM = "6"
2323
$env:GOARCH = "arm"
2424
}
25-
"armv7" {
25+
"armv7" {
2626
$env:GOARM = "7"
2727
$env:GOARCH = "arm"
2828
}
@@ -67,7 +67,7 @@ if ($env:HY_APP_VERSION) {
6767
$ldflags += " -X 'main.appVersion=$($env:HY_APP_VERSION)'"
6868
}
6969
else {
70-
$ldflags += " -X 'main.appVersion=$(git describe --tags --always)'"
70+
$ldflags += " -X 'main.appVersion=$(git describe --tags --always --match "v*")'"
7171
}
7272
if ($env:HY_APP_COMMIT) {
7373
$ldflags += " -X 'main.appCommit=$($env:HY_APP_COMMIT)'"

0 commit comments

Comments
 (0)