diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 973c0e8c7..ed4f82eed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,8 +19,12 @@ jobs: # Bazelisk will download bazel to here XDG_CACHE_HOME: ~/.cache/bazel-repo run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //... + - name: Prepare workspace snippet + run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt - name: Release uses: softprops/action-gh-release@v1 with: prerelease: true - files: bazel-out/*/bin/*.tar.gz + # Use GH feature to populate the changelog automatically + generate_release_notes: true + body_path: release_notes.txt diff --git a/.github/workflows/workspace_snippet.sh b/.github/workflows/workspace_snippet.sh new file mode 100755 index 000000000..a7fa99883 --- /dev/null +++ b/.github/workflows/workspace_snippet.sh @@ -0,0 +1,29 @@ +#!/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} +PREFIX="rules_js-${TAG:1}" +SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}') + +cat << EOF + +WORKSPACE snippet: + +\`\`\`starlark +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "aspect_rules_js", + sha256 = "${SHA}", + strip_prefix = "${PREFIX}", + url = "https://github.com/aspect-build/rules_js/archive/${TAG}.tar.gz", +) + +load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") + +rules_js_dependencies() +\`\`\` +EOF diff --git a/BUILD.bazel b/BUILD.bazel index e0075a88b..e7269d176 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,6 +1,4 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load("@rules_pkg//:pkg.bzl", "pkg_tar") -load(":version.bzl", "VERSION") load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary") gazelle_binary( @@ -13,22 +11,6 @@ gazelle( gazelle = "gazelle_bin", ) -# This declares the release artifact users -pkg_tar( - name = "rules_js-" + VERSION, - srcs = [ - "README.md", - "version.bzl", - "//js:package_content", - ], - extension = "tar.gz", - # It is all source code, so make it read-only. - mode = "0444", - # Make it owned by root so it does not have the uid of the CI robot. - owner = "0.0", - strip_prefix = ".", -) - bzl_library( name = "internal_deps", srcs = ["internal_deps.bzl"], @@ -38,9 +20,3 @@ bzl_library( "@bazel_tools//tools/build_defs/repo:utils.bzl", ], ) - -bzl_library( - name = "version", - srcs = ["version.bzl"], - visibility = ["//visibility:public"], -) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b1519649c..c144869d5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,8 +39,5 @@ This means that any usage of `@rules_js` on your system will point to this folde ## Releasing -1. Update the constant in `version.bzl` -1. `git tag v$(grep VERSION version.bzl | cut -d'"' -f2)` -1. git push --tags +1. Push a tag to the repo, or create one on the GH UI 1. Watch the automation run on GitHub actions -1. Update the release page with auto-generated release notes diff --git a/README.md b/README.md index 33f317b94..d5f09e134 100644 --- a/README.md +++ b/README.md @@ -31,32 +31,9 @@ In addition, as a clean rewrite many of the bugs in rules_nodejs are naturally r ## Installation -Include this in your WORKSPACE file: - -```starlark -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "aspect_rules_js", - sha256 = "29ede06bb95ec0216bc917aa4b49c3340a448a05bfdd1fbc68a82bbbb21a193d", - url = "https://github.com/aspect-dev/rules_js/releases/download/v0.1.0/rules_js-0.1.0.tar.gz", -) - -load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") - -# This fetches the aspect_rules_js dependencies, which are: -# - bazel_skylib -# - rules_nodejs -# - aspect_bazel_lib -# If you want to have a different version of some dependency, -# you should fetch it *before* calling this. -# Alternatively, you can skip calling this function, so long as you've -# already fetched these dependencies. -rules_js_dependencies() -``` - -> note, in the above, replace the version and sha256 with the one indicated -> in the release notes for aspect_rules_js -> In the future, our release automation should take care of this. +From the release you wish to use: + +copy the WORKSPACE snippet into your `WORKSPACE` file. ## Usage diff --git a/internal_deps.bzl b/internal_deps.bzl index ebf7e8c09..c3a24caef 100644 --- a/internal_deps.bzl +++ b/internal_deps.bzl @@ -9,16 +9,6 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def rules_js_internal_deps(): "Fetch repositories used for developing the rules" - maybe( - http_archive, - name = "rules_pkg", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz", - "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz", - ], - sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a", - ) - maybe( http_archive, name = "build_bazel_integration_testing", diff --git a/js/BUILD.bazel b/js/BUILD.bazel index 0a56a2dd9..e05880075 100644 --- a/js/BUILD.bazel +++ b/js/BUILD.bazel @@ -7,17 +7,6 @@ exports_files( visibility = ["//docs:__pkg__"], ) -filegroup( - name = "package_content", - srcs = glob([ - "*.bzl", - "*.bazel", - ]) + [ - "//js/private:package_content", - ], - visibility = ["//:__pkg__"], -) - bzl_library( name = "nodejs_binary", srcs = ["nodejs_binary.bzl"], diff --git a/js/private/BUILD.bazel b/js/private/BUILD.bazel index f72617889..169c5a736 100644 --- a/js/private/BUILD.bazel +++ b/js/private/BUILD.bazel @@ -12,15 +12,6 @@ config_setting( values = {"enable_runfiles": "true"}, ) -filegroup( - name = "package_content", - srcs = glob([ - "*.bzl", - "*.bazel", - ]), - visibility = ["//js:__pkg__"], -) - bzl_library( name = "nodejs_binary", srcs = ["nodejs_binary.bzl"], diff --git a/js/repositories.bzl b/js/repositories.bzl index 214ad0c08..0016a2826 100644 --- a/js/repositories.bzl +++ b/js/repositories.bzl @@ -35,6 +35,7 @@ def rules_js_dependencies(): maybe( http_archive, name = "aspect_bazel_lib", - sha256 = "7cb2faf813bae1712dcb09b23dd8d68fffd8631a25d54b9ca8ae866ca7debc06", - urls = ["https://github.com/aspect-build/bazel-lib/releases/download/v0.2.1/bazel_lib-0.2.1.tar.gz"], + sha256 = "e834c368f36cb336b5b42cd1dd9cd4b6bafa0ad3ed7f92f54a47e5ab436e4f59", + strip_prefix = "bazel-lib-0.3.0", + url = "https://github.com/aspect-build/bazel-lib/archive/v0.3.0.tar.gz", ) diff --git a/version.bzl b/version.bzl deleted file mode 100644 index 606ebc5cd..000000000 --- a/version.bzl +++ /dev/null @@ -1,3 +0,0 @@ -"Constants to track versioning info" - -VERSION = "0.2.0"