|
| 1 | +# Cut a release whenever a new tag is pushed to the repo. |
| 2 | +# You should use an annotated tag, like `git tag -a v1.2.3` |
| 3 | +# and put the release notes into the commit message for the tag. |
| 4 | +name: Release |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + tags: |
| 9 | + - "*.*.*" |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v3 |
| 17 | + - uses: bazelbuild/setup-bazelisk@v2 |
| 18 | + - name: Check git state is clean |
| 19 | + run: git status --porcelain |
| 20 | + - name: Export release version |
| 21 | + run: 'echo "RELEASE_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV' |
| 22 | + - name: Build release archive |
| 23 | + env: |
| 24 | + # Bazelisk will download bazel to here |
| 25 | + XDG_CACHE_HOME: ~/.cache/bazel-repo |
| 26 | + run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc build //:slamdev_toolchain_chromium |
| 27 | + - name: Set versioned archive name |
| 28 | + run: cp bazel-bin/slamdev_toolchain_chromium.tar.gz bazel-bin/slamdev_toolchain_chromium-v${{ env.RELEASE_VERSION }}.tar.gz |
| 29 | + - name: Export checksum |
| 30 | + run: 'echo "RELEASE_CHECKSUM=$(shasum -b -a 256 bazel-bin/slamdev_toolchain_chromium-v${{ env.RELEASE_VERSION }}.tar.gz | cut -d " " -f 1)" >> $GITHUB_ENV' |
| 31 | + - name: Upload release |
| 32 | + uses: softprops/action-gh-release@v1 |
| 33 | + with: |
| 34 | + files: bazel-bin/slamdev_toolchain_chromium-v${{ env.RELEASE_VERSION }}.tar.gz |
| 35 | + fail_on_unmatched_files: true |
| 36 | + body: | |
| 37 | + ```starlark |
| 38 | + http_archive( |
| 39 | + name = "slamdev_toolchain_chromium", |
| 40 | + sha256 = "${{ env.RELEASE_CHECKSUM }}", |
| 41 | + url = "https://github.com/slamdev/toolchain_chromium/releases/download/${{ env.RELEASE_VERSION }}/slamdev_toolchain_chromium-v${{ env.RELEASE_VERSION }}.tar.gz", |
| 42 | + ) |
| 43 | + ``` |
0 commit comments