Skip to content

Commit 4a64128

Browse files
Slokhampagent
andauthored
fix: build binaries for unified v* release tags (#381)
Co-authored-by: Amp <amp@ampcode.com>
1 parent 6677ad5 commit 4a64128

1 file changed

Lines changed: 39 additions & 13 deletions

File tree

.github/workflows/build.yml

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Build
33
on:
44
push:
55
tags:
6+
- "v*"
67
- "tempo-wallet@*"
78
- "tempo-request@*"
89

@@ -18,25 +19,44 @@ jobs:
1819
name: Parse tag
1920
runs-on: ubuntu-latest
2021
outputs:
21-
package: ${{ steps.parse.outputs.package }}
22+
packages: ${{ steps.parse.outputs.packages }}
2223
version: ${{ steps.parse.outputs.version }}
24+
release_tag: ${{ steps.parse.outputs.release_tag }}
2325
steps:
24-
- name: Parse package and version from tag
26+
- name: Parse release scope and version from tag
2527
id: parse
2628
run: |
2729
TAG="${GITHUB_REF#refs/tags/}"
28-
PACKAGE="${TAG%%@*}"
29-
VERSION="${TAG#*@}"
30-
echo "package=${PACKAGE}" >> "$GITHUB_OUTPUT"
31-
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
32-
echo "Tag: ${TAG}, Package: ${PACKAGE}, Version: ${VERSION}"
30+
31+
if [[ "$TAG" == v* ]]; then
32+
VERSION="${TAG#v}"
33+
PACKAGES='["tempo-wallet","tempo-request"]'
34+
RELEASE_TAG="$TAG"
35+
elif [[ "$TAG" == *"@"* ]]; then
36+
PACKAGE="${TAG%%@*}"
37+
VERSION="${TAG#*@}"
38+
PACKAGES="[\"${PACKAGE}\"]"
39+
RELEASE_TAG="$TAG"
40+
else
41+
echo "Unsupported tag format: ${TAG}" >&2
42+
exit 1
43+
fi
44+
45+
{
46+
echo "packages=${PACKAGES}"
47+
echo "version=${VERSION}"
48+
echo "release_tag=${RELEASE_TAG}"
49+
} >> "$GITHUB_OUTPUT"
50+
echo "Tag: ${TAG}, Packages: ${PACKAGES}, Version: ${VERSION}, Release tag: ${RELEASE_TAG}"
3351
3452
build:
35-
name: Build ${{ matrix.target }}
53+
name: Build ${{ matrix.package }} (${{ matrix.target }})
3654
needs: [parse-tag]
3755
runs-on: ${{ matrix.os }}
3856
strategy:
57+
fail-fast: false
3958
matrix:
59+
package: ${{ fromJson(needs.parse-tag.outputs.packages) }}
4060
include:
4161
- os: ubuntu-latest
4262
target: x86_64-unknown-linux-gnu
@@ -51,7 +71,7 @@ jobs:
5171
target: aarch64-apple-darwin
5272
suffix: darwin-arm64
5373
env:
54-
PACKAGE: ${{ needs.parse-tag.outputs.package }}
74+
PACKAGE: ${{ matrix.package }}
5575
steps:
5676
- uses: actions/checkout@v6
5777
- uses: dtolnay/rust-toolchain@stable
@@ -72,24 +92,30 @@ jobs:
7292
path: ${{ env.PACKAGE }}-${{ matrix.suffix }}
7393

7494
publish:
75-
name: Publish
95+
name: Publish ${{ matrix.package }}
7696
needs: [parse-tag, build]
7797
runs-on: ubuntu-latest
98+
strategy:
99+
fail-fast: false
100+
matrix:
101+
package: ${{ fromJson(needs.parse-tag.outputs.packages) }}
78102
env:
79-
PACKAGE: ${{ needs.parse-tag.outputs.package }}
103+
PACKAGE: ${{ matrix.package }}
80104
VERSION: ${{ needs.parse-tag.outputs.version }}
105+
RELEASE_TAG: ${{ needs.parse-tag.outputs.release_tag }}
81106
steps:
82107
- uses: actions/checkout@v6
83108
- uses: actions/download-artifact@v8
84109
with:
85110
path: artifacts
111+
pattern: ${{ env.PACKAGE }}-*
86112
merge-multiple: true
87113

88114
- name: Wait for GitHub Release
89115
env:
90116
GH_TOKEN: ${{ github.token }}
91117
run: |
92-
TAG="${PACKAGE}@${VERSION}"
118+
TAG="${RELEASE_TAG}"
93119
for i in $(seq 1 40); do
94120
if gh release view "$TAG" >/dev/null 2>&1; then
95121
echo "Release ${TAG} found"
@@ -105,7 +131,7 @@ jobs:
105131
env:
106132
GH_TOKEN: ${{ github.token }}
107133
run: |
108-
TAG="${PACKAGE}@${VERSION}"
134+
TAG="${RELEASE_TAG}"
109135
gh release upload "$TAG" artifacts/* --clobber
110136
111137
- name: Configure git auth

0 commit comments

Comments
 (0)