|
1 | 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 | 2 | name: Release |
5 | | - |
6 | 3 | on: |
| 4 | + # Can be triggered from the tag.yaml workflow |
| 5 | + workflow_call: |
| 6 | + inputs: |
| 7 | + tag_name: |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + secrets: |
| 11 | + publish_token: |
| 12 | + required: true |
| 13 | + # Or, developers can manually push a tag from their clone |
7 | 14 | push: |
8 | 15 | tags: |
9 | 16 | - "v*.*.*" |
10 | | - |
| 17 | +permissions: |
| 18 | + id-token: write |
| 19 | + attestations: write |
| 20 | + contents: write |
11 | 21 | jobs: |
12 | | - build: |
13 | | - runs-on: ubuntu-latest |
14 | | - steps: |
15 | | - - name: Checkout |
16 | | - uses: actions/checkout@v3 |
17 | | - |
18 | | - - name: Set output |
19 | | - id: vars |
20 | | - run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT |
21 | | - |
22 | | - - name: Mount bazel action cache |
23 | | - uses: actions/cache@v3 |
24 | | - if: always() |
25 | | - with: |
26 | | - path: "~/.cache/bazel" |
27 | | - key: bazel |
28 | | - |
29 | | - - name: Mount bazel repo cache |
30 | | - uses: actions/cache@v3 |
31 | | - if: always() |
32 | | - with: |
33 | | - path: "~/.cache/bazel-repo" |
34 | | - key: bazel-repo |
35 | | - |
36 | | - - name: build release binaries |
37 | | - env: |
38 | | - # Bazelisk will download bazel to here |
39 | | - XDG_CACHE_HOME: ~/.cache/bazel-repo |
40 | | - run: >- |
41 | | - bazel |
42 | | - --bazelrc=.github/workflows/ci.bazelrc |
43 | | - --bazelrc=.bazelrc |
44 | | - build |
45 | | - //cmd/aquerydiff:all |
46 | | -
|
47 | | - - name: Prepare release assets |
48 | | - env: |
49 | | - # Bazelisk will download bazel to here |
50 | | - RELEASE_VERSION: ${{ steps.vars.outputs.tag }} |
51 | | - run: >- |
52 | | - cp bazel-bin/cmd/aquerydiff/aquerydiff_darwin_amd64.zip aquerydiff_darwin_amd64.${{ env.RELEASE_VERSION }}.zip && |
53 | | - cp bazel-bin/cmd/aquerydiff/aquerydiff_darwin_arm64.zip aquerydiff_darwin_arm64.${{ env.RELEASE_VERSION }}.zip && |
54 | | - cp bazel-bin/cmd/aquerydiff/aquerydiff_linux_amd64.zip aquerydiff_linux_amd64.${{ env.RELEASE_VERSION }}.zip && |
55 | | - cp bazel-bin/cmd/aquerydiff/aquerydiff_linux_arm64.zip aquerydiff_linux_arm64.${{ env.RELEASE_VERSION }}.zip && |
56 | | - cp bazel-bin/cmd/aquerydiff/aquerydiff_windows_amd64.zip aquerydiff_windows_amd64.${{ env.RELEASE_VERSION }}.zip && |
57 | | - echo "done" |
58 | | -
|
59 | | - - name: Release |
60 | | - env: |
61 | | - RELEASE_VERSION: ${{ steps.vars.outputs.tag }} |
62 | | - uses: softprops/action-gh-release@v1 |
63 | | - with: |
64 | | - files: | |
65 | | - aquerydiff_darwin_amd64.${{ env.RELEASE_VERSION }}.zip |
66 | | - aquerydiff_darwin_arm64.${{ env.RELEASE_VERSION }}.zip |
67 | | - aquerydiff_linux_amd64.${{ env.RELEASE_VERSION }}.zip |
68 | | - aquerydiff_linux_arm64.${{ env.RELEASE_VERSION }}.zip |
69 | | - aquerydiff_windows_amd64.${{ env.RELEASE_VERSION }}.zip |
| 22 | + release: |
| 23 | + uses: bazel-contrib/.github/.github/workflows/[email protected] |
| 24 | + # uses: ./.github/workflows/release_ruleset.yaml # copied-from: bazel-contrib/.github/.github/workflows/[email protected] |
| 25 | + with: |
| 26 | + prerelease: false |
| 27 | + release_files: rules_proto-*.tar.gz |
| 28 | + tag_name: ${{ inputs.tag_name || github.ref_name }} |
| 29 | + secrets: |
| 30 | + inherit |
| 31 | + publish: |
| 32 | + needs: release |
| 33 | + uses: ./.github/workflows/publish.yaml |
| 34 | + with: |
| 35 | + tag_name: ${{ inputs.tag_name || github.ref_name }} |
| 36 | + secrets: |
| 37 | + publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }} |
0 commit comments