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