Skip to content

Commit

Permalink
chore: update release automation
Browse files Browse the repository at this point in the history
It should match bazel-contrib/rules-template
  • Loading branch information
alexeagle committed Apr 2, 2023
1 parent 2bb45a5 commit 283a54b
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 91 deletions.
12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/BUG-REPORT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@ description: File a bug report to help us improve
title: "[Bug]: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
**rules_nodejs is mostly unmaintained!**
Only the "core" module (code under the /nodejs folder) is maintained by volunteers from Aspect.dev.
This includes only the nodejs toolchain and a few Provider types.
If you're having an issue with anything else, you can still file it but you shouldn't expect any help.
If you're looking for support, try the `#javascript` channel on [Bazel slack](https://slack.bazel.build).
- type: textarea
id: what-happened
attributes:
Expand Down
11 changes: 0 additions & 11 deletions .github/ISSUE_TEMPLATE/FEATURE-REQUEST.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@ description: Suggest an idea for the rules_nodejs toolchain
title: "[FR]: "
labels: ["enhancement"]
body:

- type: markdown
attributes:
value: |
**rules_nodejs is mostly unmaintained!**
Only the "core" module (code under the /nodejs folder) is maintained by volunteers from Aspect.dev.
This includes only the nodejs toolchain and a few Provider types.
Features outside that module are probably never going to be built or accepted.
- type: textarea
id: current
attributes:
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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
- name: Mount bazel caches
uses: actions/cache@v3
with:
path: |
~/.cache/bazel
~/.cache/bazel-repo
key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE') }}
restore-keys: bazel-cache-
- name: bazel test //...
env:
# Bazelisk will download bazel to here
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //...
- name: Prepare release notes and artifacts
run: .github/workflows/release_prep.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt
- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: true
# Use GH feature to populate the changelog automatically
generate_release_notes: true
body_path: release_notes.txt
fail_on_unmatched_files: true
files: rules_nodejs-*.tar.gz
40 changes: 40 additions & 0 deletions .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

set -o errexit -o nounset -o pipefail

# Set by GH actions, see
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
TAG=${GITHUB_REF_NAME}
# The prefix is chosen to match what GitHub generates for source archives
PREFIX="rules_nodejs-${TAG:1}"
ARCHIVE="rules_nodejs-$TAG.tar.gz"
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')

cat << EOF
## Using Bzlmod with Bazel 6
1. Enable with \`common --enable_bzlmod\` in \`.bazelrc\`.
2. Add to your \`MODULE.bazel\` file:
\`\`\`starlark
bazel_dep(name = "rules_nodejs", version = "${TAG:1}")
\`\`\`
## Using WORKSPACE
Paste this snippet into your `WORKSPACE.bazel` file:
\`\`\`starlark
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_nodejs",
sha256 = "${SHA}",
strip_prefix = "${PREFIX}",
url = "https://github.com/bazelbuild/rules_nodejs/releases/download/${TAG}/${ARCHIVE}",
)
EOF

# TODO: fill in more snippet if/when we have an e2e that illustrates what is needed
# awk 'f;/--SNIP--/{f=1}' e2e/smoke/WORKSPACE.bazel
echo "\`\`\`"
44 changes: 0 additions & 44 deletions .github/workflows/update-yarn-versions.yml

This file was deleted.

27 changes: 3 additions & 24 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,27 +87,6 @@ rules](./docs/changing-rules.md) instead of building your own release products.

## Releasing

Start from a clean checkout at master/HEAD.

Note: if you are using a new clone, you'll need to configure `git-clang-format` to be able to commit the release:

1. `git config clangFormat.binary node_modules/.bin/clang-format`
1. `git config clangFormat.style file`

Googlers: you should npm login using the go/npm-publish service: `$ npm login --registry https://wombat-dressing-room.appspot.com`

Check if there are any breaking changes since the last tag - if so, this will be a major. Check if there were new features added since the last tag - if so, this will be a minor.

1. `npm version [major|minor|patch]` (`major` if there are breaking changes, `minor` if there are new features, otherwise `patch`)
1. Manually update the CHANGELOG.md based on the commits since the last release. Look for breaking changes that weren't documented.
1. If publishing from inside Google, set NPM_REGISTRY="--registry https://wombat-dressing-room.appspot.com" in your environment
1. Build npm packages and publish them: `./scripts/publish_release.sh` (for a release candidate, add arguments `publish next`)
1. Run `./scripts/update_nested_lock_files.sh` to update the lock files in all nested workspaces to new release
1. `git commit -a -m 'chore: update lock files for release'`
1. `git push && git push --tags`
1. (Manual for now): go to the [releases] page, edit the release with rough changelog (especially note any breaking changes!) and upload the release artifact from `rules_nodejs-[version].tar.gz`. Also copy the release notes from CHANGELOG.md
1. Re-deprecate npm packages, since publishing causes them to become un-deprecated:
- `npm --otp=123456 deprecate @bazel/typescript 'No longer maintained, https://github.com/aspect-build/rules_ts is the recommended replacement'`
1. Announce the release on Bazel slack in `#javascript

[releases]: https://github.com/bazelbuild/rules_nodejs/releases
1. Determine the next release version, following semver (could automate in the future from changelog)
2. Tag the repo and push it (or create a tag in GH UI)
3. Watch the automation run on GitHub actions

0 comments on commit 283a54b

Please sign in to comment.