chore: update release automation
It should match bazel-contrib/rules-template
diff --git a/.github/ISSUE_TEMPLATE/BUG-REPORT.yaml b/.github/ISSUE_TEMPLATE/BUG-REPORT.yaml
index 983c835..0c41e10 100644
--- a/.github/ISSUE_TEMPLATE/BUG-REPORT.yaml
+++ b/.github/ISSUE_TEMPLATE/BUG-REPORT.yaml
@@ -3,18 +3,6 @@
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:
diff --git a/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yaml b/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yaml
index 9c446fe..5a322d5 100644
--- a/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yaml
+++ b/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yaml
@@ -3,17 +3,6 @@
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:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..7dfd408
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -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
diff --git a/.github/workflows/release_prep.sh b/.github/workflows/release_prep.sh
new file mode 100644
index 0000000..93644cc
--- /dev/null
+++ b/.github/workflows/release_prep.sh
@@ -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 "\`\`\`"
\ No newline at end of file
diff --git a/.github/workflows/update-yarn-versions.yml b/.github/workflows/update-yarn-versions.yml
deleted file mode 100644
index f6bfec1..0000000
--- a/.github/workflows/update-yarn-versions.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-name: Update yarn versions
-
-on:
- schedule:
- # run at 01:30 UTC daily
- - cron: '30 1 * * *'
-
-permissions:
- contents: read
-
-jobs:
- updateNodejsVersions:
- runs-on: ubuntu-latest
-
- # Skip this on forks
- if: github.repository == 'bazelbuild/rules_nodejs'
-
- steps:
- - name: Git Checkout
- uses: actions/checkout@v2
- with:
- fetch-depth: 0
-
- - name: Setup NodeJS
- uses: actions/setup-node@v2
- with:
- node-version: '14.x'
-
- - name: Run yarn update-yarn-versions
- run: yarn run update-yarn-versions
-
- - name: Create Pull Request
- uses: peter-evans/create-pull-request@v3
- with:
- token: ${{ secrets.PAT }}
- commit-message: Update yarn versions
- title: Update yarn versions
- body: |
- - Updated yarn versions using `yarn run update-yarn-versions`
-
- Auto-generated by [create-pull-request][1]
-
- [1]: https://github.com/peter-evans/create-pull-request
- branch: update-yarn-versions
diff --git a/DEVELOPING.md b/DEVELOPING.md
index c8efea4..a28eab9 100644
--- a/DEVELOPING.md
+++ b/DEVELOPING.md
@@ -87,27 +87,6 @@
## 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