bazel-lib/.github/workflows/release.yml

55 lines
2.0 KiB
YAML
Raw Normal View History

2021-11-08 14:20:26 +00:00
# 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:
- "v*.*.*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
2022-01-21 16:48:43 +00:00
- name: Mount bazel caches
uses: actions/cache@v3
2022-01-21 16:48:43 +00:00
with:
path: |
2022-08-04 00:05:22 +00:00
~/.cache/bazel
~/.cache/bazel-repo
2022-01-21 16:48:43 +00:00
key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE') }}
restore-keys: bazel-cache-
2021-11-08 14:20:26 +00:00
- name: bazel test //...
env:
# Bazelisk will download bazel to here
XDG_CACHE_HOME: ~/.cache/bazel-repo
2021-11-08 15:26:45 +00:00
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //...
- name: Build release artifacts
run: |
if [ -n "$(git status --porcelain)" ]; then
>&2 echo "ERROR: the git state is not clean, aborting build..."
exit 1
fi
rm -rf /tmp/aspect/release
bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc run --config=release //tools:release -- /tmp/aspect/release
if /tmp/aspect/release/copy_to_directory-linux_amd64 version | grep '(with local changes)'; then
>&2 echo "ERROR: the release contained changes in the git state and the release will not be produced"
exit 1
fi
2023-01-03 20:37:05 +00:00
- name: Prepare workspace snippet
run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt
2021-11-08 14:20:26 +00:00
- name: Release
uses: softprops/action-gh-release@v1
with:
# Use GH feature to populate the changelog automatically
generate_release_notes: true
files: |
/tmp/aspect/release/*
bazel-lib-*.tar.gz
body_path: release_notes.txt
2022-09-19 20:12:35 +00:00
token: ${{ secrets.DEREK_BCR_PAT }}
fail_on_unmatched_files: true