mirror of
https://github.com/bazel-contrib/bazel-lib
synced 2024-11-30 01:41:21 +00:00
81633f0c77
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
57 lines
2.1 KiB
YAML
57 lines
2.1 KiB
YAML
# 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@v4
|
|
- name: Mount bazel caches
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cache/bazel
|
|
~/.cache/bazel-repo
|
|
key: bazel-cache-release-${{ hashFiles('.bazelrc', '.bazelversion', '.bazeliskrc', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel', 'MODULE.bazel.lock') }}
|
|
restore-keys: bazel-cache-release-
|
|
- name: bazel test //... (release)
|
|
env:
|
|
# Bazelisk will download bazel to here
|
|
XDG_CACHE_HOME: ~/.cache/bazel-repo
|
|
run: |
|
|
bazel --bazelrc=.aspect/bazelrc/ci.bazelrc \
|
|
--bazelrc=.github/workflows/ci.bazelrc \
|
|
--bazelrc=.aspect/bazelrc/bazel6.bazelrc \
|
|
test --config=local //...
|
|
- 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=.aspect/bazelrc/ci.bazelrc \
|
|
--bazelrc=.github/workflows/ci.bazelrc \
|
|
--bazelrc=.aspect/bazelrc/bazel6.bazelrc \
|
|
run --config=local //tools/release -- /tmp/aspect/release
|
|
- name: Prepare workspace snippet
|
|
run: .github/workflows/release_prep.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt
|
|
- 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
|
|
fail_on_unmatched_files: true
|