Skip to content

Commit 2d1ded9

Browse files
committed
fix: update artifact naming and copying logic for macOS build
1 parent f3ff3c0 commit 2d1ded9

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

.github/workflows/bazel_cli_build.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,28 @@ jobs:
8282
repository-cache: true
8383
- name: Build All
8484
run: bazel build //...
85-
- name: Copy and rename artifact
86-
uses: ./.github/actions/copy-artifact
87-
with:
88-
source: bazel-bin/sparrow-cli.tar.gz
89-
platform: mac
85+
- name: Prepare artifact name and copy
86+
run: |
87+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
88+
TAG_NAME="${GITHUB_REF#refs/tags/}"
89+
ARTIFACT_NAME="sparrow-cli-${TAG_NAME}-mac"
90+
cp bazel-bin/sparrow-cli.tar.gz "${ARTIFACT_NAME}.tar.gz"
91+
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
92+
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
93+
else
94+
SHORT_COMMIT="$(echo ${{ github.sha }} | cut -c1-7)"
95+
ARTIFACT_NAME="sparrow-cli-${SHORT_COMMIT}-mac"
96+
cp bazel-bin/sparrow-cli.tar.gz "${ARTIFACT_NAME}.tar.gz"
97+
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
98+
fi
9099
- name: Upload sparrow-cli.tar.gz artifact
91100
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
92101
uses: actions/upload-artifact@v4
93102
with:
94103
name: ${{ env.ARTIFACT_NAME }}
95-
path: sparrow-cli-*-mac.tar.gz
104+
path: ${{ env.ARTIFACT_NAME }}.tar.gz
96105
- name: Upload to Release
97106
if: startsWith(github.ref, 'refs/tags/')
98107
uses: softprops/action-gh-release@v1
99108
with:
100-
files: sparrow-cli-${{ env.TAG_NAME }}-mac.tar.gz
109+
files: ${{ env.ARTIFACT_NAME }}.tar.gz

0 commit comments

Comments
 (0)