|
6 | 6 | - 'doc/**'
|
7 | 7 | - 'example/**'
|
8 | 8 | - '**/*.md'
|
| 9 | + tags: |
| 10 | + - '*' |
9 | 11 | pull_request:
|
10 | 12 | paths-ignore:
|
11 | 13 | - 'doc/**'
|
@@ -37,11 +39,27 @@ jobs:
|
37 | 39 | repository-cache: true
|
38 | 40 | - name: Build All
|
39 | 41 | 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 |
40 | 52 | - name: Upload sparrow-cli.tar.gz artifact
|
| 53 | + if: ${{ !startsWith(github.ref, 'refs/tags/') }} |
41 | 54 | uses: actions/upload-artifact@v4
|
42 | 55 | with:
|
43 | 56 | 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 |
45 | 63 |
|
46 | 64 | build-macos:
|
47 | 65 | runs-on: macos-latest
|
|
60 | 78 | repository-cache: true
|
61 | 79 | - name: Build All
|
62 | 80 | 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 |
63 | 91 | - name: Upload sparrow-cli.tar.gz artifact
|
| 92 | + if: ${{ !startsWith(github.ref, 'refs/tags/') }} |
64 | 93 | uses: actions/upload-artifact@v4
|
65 | 94 | with:
|
66 | 95 | 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