Skip to content

Commit

Permalink
ci: fix build scripts to handle multi-tags
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyxdd committed Dec 11, 2022
1 parent 7430f37 commit b25d41e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/release-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ jobs:

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

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand Down
2 changes: 1 addition & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tasks:
label: build-{{.TASK}}
vars:
BUILD_VERSION:
sh: git describe --tags
sh: git describe --tags --always --match 'v*'
BUILD_COMMIT:
sh: git rev-parse HEAD
BUILD_DATE:
Expand Down
12 changes: 6 additions & 6 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ function PlatformToEnv($os, $arch) {
$env:CGO_ENABLED = 0
$env:GOOS = $os
$env:GOARCH = $arch

switch -Regex ($arch) {
"arm" {
"arm" {
$env:GOARM = "7"
}
"armv5" {
"armv5" {
$env:GOARM = "5"
$env:GOARCH = "arm"
}
"armv6" {
"armv6" {
$env:GOARM = "6"
$env:GOARCH = "arm"
}
"armv7" {
"armv7" {
$env:GOARM = "7"
$env:GOARCH = "arm"
}
Expand Down Expand Up @@ -67,7 +67,7 @@ if ($env:HY_APP_VERSION) {
$ldflags += " -X 'main.appVersion=$($env:HY_APP_VERSION)'"
}
else {
$ldflags += " -X 'main.appVersion=$(git describe --tags --always)'"
$ldflags += " -X 'main.appVersion=$(git describe --tags --always --match "v*")'"
}
if ($env:HY_APP_COMMIT) {
$ldflags += " -X 'main.appCommit=$($env:HY_APP_COMMIT)'"
Expand Down

0 comments on commit b25d41e

Please sign in to comment.