Skip to content

Commit 4ace4bf

Browse files
committed
chore: add auto-release
Downstreams bazel-contrib/rules-template#129 Addresses #3821 Also remove the bit about signing the Google CLA, which doesn't apply now that the repo was donated to Linux Foundation.
1 parent ae702c7 commit 4ace4bf

File tree

4 files changed

+77
-36
lines changed

4 files changed

+77
-36
lines changed

.github/workflows/release.yml

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
# 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.
42
name: Release
5-
63
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+
# Or, developers can manually push a tag from their clone
711
push:
812
tags:
913
- "v*.*.*"
10-
14+
permissions:
15+
contents: write
1116
jobs:
1217
release:
13-
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v6
18+
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@0b644c3ee5c7cd9a7657f7e782b26a599d9b6d5c # 2025-01-23
1419
with:
1520
prerelease: false
1621
release_files: rules_nodejs-*.tar.gz
22+
tag_name: ${{ inputs.tag_name }}

.github/workflows/release_prep.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
set -o errexit -o nounset -o pipefail
44

5-
# Set by GH actions, see
6-
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
7-
TAG=${GITHUB_REF_NAME}
5+
# Argument provided by reusable workflow caller, see
6+
# https://github.com/bazel-contrib/.github/blob/d197a6427c5435ac22e56e33340dff912bc9334e/.github/workflows/release_ruleset.yaml#L72
7+
TAG=$1
88
# The prefix is chosen to match what GitHub generates for source archives
99
PREFIX="rules_nodejs-${TAG:1}"
1010
ARCHIVE="rules_nodejs-$TAG.tar.gz"
1111
git archive --format=tar --prefix="${PREFIX}/" "${TAG}" | gzip > "$ARCHIVE"
1212
SHA=$(shasum -a 256 "$ARCHIVE" | awk '{print $1}')
1313

1414
cat << EOF
15-
## Using Bzlmod with Bazel 6
15+
## Using Bzlmod with Bazel 6 or greater
1616
17-
1. Enable with \`common --enable_bzlmod\` in \`.bazelrc\`.
17+
1. (Bazel 6 only) Enable with \`common --enable_bzlmod\` in \`.bazelrc\`.
1818
2. Add to your \`MODULE.bazel\` file:
1919
2020
\`\`\`starlark

.github/workflows/tag.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Tag a new release using https://github.com/marketplace/actions/conventional-commits-versioner-action
2+
#
3+
# This is easier than having to run manual `git` operations on a local clone.
4+
# It also runs on a schedule so we don't leave commits unreleased indefinitely
5+
# (avoiding users having to ping "hey could someone cut a release").
6+
7+
name: Tag a Release
8+
on:
9+
# Allow devs to tag manually through the GitHub UI.
10+
# For example after landing a fix that customers are waiting for.
11+
workflow_dispatch:
12+
# Run twice a month, on the 3rd and 18th at 3PM UTC (8AM PST)
13+
# This is a trade-off between making too many releases,
14+
# which overwhelms BCR maintainers and over-notifies users,
15+
# and releasing too infrequently which delays delivery of bugfixes and features.
16+
schedule:
17+
- cron: "0 15 3,18 * *"
18+
jobs:
19+
tag:
20+
permissions:
21+
contents: write # allow create tag
22+
runs-on: ubuntu-latest
23+
outputs:
24+
new-tag: ${{ steps.ccv.outputs.new-tag }}
25+
new-tag-version: ${{steps.ccv.outputs.new-tag-version}}
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
# Need enough history to find the prior release tag
30+
fetch-depth: 0
31+
- name: Bump tag if necessary
32+
id: ccv
33+
uses: smlx/ccv@7318e2f25a52dcd550e75384b84983973251a1f8 # v0.10.0
34+
release:
35+
needs: tag
36+
uses: ./.github/workflows/release.yml
37+
with:
38+
tag_name: ${{ needs.tag.outputs.new-tag-version }}
39+
if: needs.tag.outputs.new-tag == 'true' && needs.tag.outputs.new-tag-version-type != 'major'
40+
permissions:
41+
contents: write # allow create release

CONTRIBUTING.md

+20-26
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,32 @@ pre-commit install
1313

1414
Otherwise the Buildkite CI will yell at you about formatting/linting violations.
1515

16-
### Before you contribute
17-
18-
**Before we can use your code, you must sign the
19-
[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1)
20-
(CLA)**, which you can do online.
21-
22-
The CLA is necessary mainly because you own the copyright to your changes,
23-
even after your contribution becomes part of our codebase, so we need your
24-
permission to use and distribute your code. We also need to be sure of
25-
various other things for instance that you'll tell us if you know that
26-
your code infringes on other people's patents. You don't have to sign
27-
the CLA until after you've submitted your code for review and a member has
28-
approved it, but you must do it before we can put your code into our codebase.
29-
30-
Before you start working on a larger contribution, you should get in touch
31-
with us first. Use the issue tracker to explain your idea so we can help and
32-
possibly guide you.
33-
34-
**Before starting a complex contribution we strongly encourage you to share a design document**.
35-
36-
[Here](https://goo.gl/YCQttR) you can find a document template.
37-
3816
### Code reviews and other contributions.
3917

4018
**All submissions, including submissions by project members, require review.**
4119
We use GitHub's code review system to suggest changes, then merge the changes
4220
to master when the PR is green and reviewed. The changes will then be in the
4321
next release.
4422

45-
### The small print
23+
## Releasing
24+
25+
Releases are automated on a cron trigger.
26+
The new version is determined automatically from the commit history, assuming the commit messages follow conventions, using
27+
https://github.com/marketplace/actions/conventional-commits-versioner-action.
28+
If you do nothing, eventually the newest commits will be released automatically as a patch or minor release.
29+
This automation is defined in .github/workflows/tag.yaml.
30+
31+
Rather than wait for the cron event, you can trigger manually. Navigate to
32+
https://github.com/bazel-contrib/rules_nodejs/actions/workflows/tag.yaml
33+
and press the "Run workflow" button.
4634

47-
Contributions made by corporations are covered by a different agreement than
48-
the one above, the
49-
[Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate).
35+
If you need control over the next release version, for example when making a release candidate for a new major,
36+
then: tag the repo and push the tag, for example
37+
38+
```sh
39+
% git fetch
40+
% git tag v1.0.0-rc0 origin/main
41+
% git push origin v1.0.0-rc0
42+
```
5043

44+
Then watch the automation run on GitHub actions which creates the release.

0 commit comments

Comments
 (0)