Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 304a970

Browse files
zhouang777Copilot
andauthored
Update .github/workflows/bazel_cli_build.yml
merge artifact name step Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 1dc9097 commit 304a970

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

‎.github/workflows/bazel_cli_build.yml‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,29 +39,31 @@ jobs:
3939
repository-cache: true
4040
- name: Build All
4141
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.tar.gz sparrow-cli-${TAG_NAME}-linux.tar.gz
47-
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
48-
- name: Rename artifact with commit hash for push
49-
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
42+
- name: Prepare artifact name and copy
5043
run: |
51-
SHORT_COMMIT=$(echo ${{ github.sha }} | cut -c1-7)
52-
cp bazel-bin/sparrow-cli.tar.gz sparrow-cli-${SHORT_COMMIT}-linux.tar.gz
53-
echo "ARTIFACT_NAME=sparrow-cli-${SHORT_COMMIT}-linux" >> $GITHUB_ENV
44+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
45+
TAG_NAME="${GITHUB_REF#refs/tags/}"
46+
ARTIFACT_NAME="sparrow-cli-${TAG_NAME}-linux"
47+
cp bazel-bin/sparrow-cli.tar.gz "${ARTIFACT_NAME}.tar.gz"
48+
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
49+
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
50+
else
51+
SHORT_COMMIT="$(echo ${{ github.sha }} | cut -c1-7)"
52+
ARTIFACT_NAME="sparrow-cli-${SHORT_COMMIT}-linux"
53+
cp bazel-bin/sparrow-cli.tar.gz "${ARTIFACT_NAME}.tar.gz"
54+
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
55+
fi
5456
- name: Upload sparrow-cli.tar.gz artifact
5557
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
5658
uses: actions/upload-artifact@v4
5759
with:
5860
name: ${{ env.ARTIFACT_NAME }}
59-
path: sparrow-cli-*-linux.tar.gz
61+
path: ${{ env.ARTIFACT_NAME }}.tar.gz
6062
- name: Upload to Release
6163
if: startsWith(github.ref, 'refs/tags/')
6264
uses: softprops/action-gh-release@v1
6365
with:
64-
files: sparrow-cli-*-linux.tar.gz
66+
files: ${{ env.ARTIFACT_NAME }}.tar.gz
6567

6668
build-macos:
6769
runs-on: macos-14

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /