Skip to content

Commit 4ac4d60

Browse files
committed
rename artifacts
1 parent 51f8c80 commit 4ac4d60

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

.github/workflows/bazel_cli_build.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
- 'doc/**'
77
- 'example/**'
88
- '**/*.md'
9+
tags:
10+
- '*'
911
pull_request:
1012
paths-ignore:
1113
- 'doc/**'
@@ -37,11 +39,27 @@ jobs:
3739
repository-cache: true
3840
- name: Build All
3941
run: bazel build //...
42+
- name: Rename artifact with tag for release
43+
if: startsWith(github.ref, 'refs/tags/')
44+
run: |
45+
TAG_NAME=${GITHUB_REF#refs/tags/}
46+
cp bazel-bin/sparrow-cli-linux.tar.gz sparrow-cli-${TAG_NAME}-linux.tar.gz
47+
- name: Rename artifact with commit hash for push
48+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
49+
run: |
50+
SHORT_COMMIT=$(echo ${{ github.sha }} | cut -c1-7)
51+
cp bazel-bin/sparrow-cli-linux.tar.gz sparrow-cli-${SHORT_COMMIT}-linux.tar.gz
4052
- name: Upload sparrow-cli.tar.gz artifact
53+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
4154
uses: actions/upload-artifact@v4
4255
with:
4356
name: sparrow-cli-linux
44-
path: bazel-bin/sparrow-cli-linux.tar.gz
57+
path: sparrow-cli-*-linux.tar.gz
58+
- name: Upload to Release
59+
if: startsWith(github.ref, 'refs/tags/')
60+
uses: softprops/action-gh-release@v1
61+
with:
62+
files: sparrow-cli-*-linux.tar.gz
4563

4664
build-macos:
4765
runs-on: macos-latest
@@ -60,8 +78,24 @@ jobs:
6078
repository-cache: true
6179
- name: Build All
6280
run: bazel build //...
81+
- name: Rename artifact with tag for release
82+
if: startsWith(github.ref, 'refs/tags/')
83+
run: |
84+
TAG_NAME=${GITHUB_REF#refs/tags/}
85+
cp bazel-bin/sparrow-cli-mac.tar.gz sparrow-cli-${TAG_NAME}-mac.tar.gz
86+
- name: Rename artifact with commit hash for push
87+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
88+
run: |
89+
SHORT_COMMIT=$(echo ${{ github.sha }} | cut -c1-7)
90+
cp bazel-bin/sparrow-cli-mac.tar.gz sparrow-cli-${SHORT_COMMIT}-mac.tar.gz
6391
- name: Upload sparrow-cli.tar.gz artifact
92+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
6493
uses: actions/upload-artifact@v4
6594
with:
6695
name: sparrow-cli-macos
67-
path: bazel-bin/sparrow-cli-mac.tar.gz
96+
path: sparrow-cli-*-mac.tar.gz
97+
- name: Upload to Release
98+
if: startsWith(github.ref, 'refs/tags/')
99+
uses: softprops/action-gh-release@v1
100+
with:
101+
files: sparrow-cli-*-mac.tar.gz

0 commit comments

Comments
 (0)