Skip to content

Commit 146169b

Browse files
authored
Merge pull request #42 from CodeIntelligenceTesting/bcr
Set up "push tag to release" workflow
2 parents 899f8b8 + 16edebf commit 146169b

9 files changed

+116
-0
lines changed

.bazelrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Required by the release workflow

.bcr/config.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fixedReleaser:
2+
login: eed3si9n
3+

.bcr/metadata.template.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"homepage": "https://github.com/bazeltools/bazel_jar_jar",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "eed3si9n",
7+
"name": "Eugene Yokota"
8+
}
9+
],
10+
"repository": [
11+
"github:bazeltools/bazel_jar_jar"
12+
],
13+
"versions": [],
14+
"yanked_versions": {}
15+
}

.bcr/presubmit.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
bcr_test_module:
2+
module_path: test
3+
matrix:
4+
platform:
5+
- debian10
6+
- ubuntu2004
7+
- macos
8+
- macos_arm64
9+
- windows
10+
tasks:
11+
run_test_module:
12+
name: Run test module
13+
platform: ${{ platform }}
14+
build_targets:
15+
- //...
16+
test_targets:
17+
- //...

.bcr/source.template.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"integrity": "",
3+
"strip_prefix": "{REPO}-{VERSION}",
4+
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.tar.gz"
5+
}

.github/workflows/ci.bazelrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Required by the release workflow

.github/workflows/release.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Based on
2+
# https://github.com/bazel-contrib/rules-template/blob/07fefdbc09d7ca2a49d24220e00dac2efc2bf9b7/.github/workflows/release.yml
3+
4+
# Cut a release whenever a new tag is pushed to the repo.
5+
# You should use an annotated tag, like `git tag -a v1.2.3`
6+
# and put the release notes into the commit message for the tag.
7+
name: Release
8+
9+
on:
10+
push:
11+
tags:
12+
- "v*.*.*"
13+
14+
jobs:
15+
release:
16+
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v5
17+
with:
18+
release_files: bazel_jar_jar-*.tar.gz

.github/workflows/release_prep.sh

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env bash
2+
3+
# Based on
4+
# https://github.com/bazel-contrib/rules-template/blob/07fefdbc09d7ca2a49d24220e00dac2efc2bf9b7/.github/workflows/release_prep.sh
5+
6+
set -o errexit -o nounset -o pipefail
7+
8+
# Set by GH actions, see
9+
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
10+
TAG=${GITHUB_REF_NAME}
11+
# The prefix is chosen to match what GitHub generates for source archives
12+
PREFIX="bazel_jar_jar-${TAG:1}"
13+
ARCHIVE="bazel_jar_jar-$TAG.tar.gz"
14+
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
15+
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
16+
17+
cat << EOF
18+
## Using Bzlmod
19+
20+
1. Enable with \`common --enable_bzlmod\` in \`.bazelrc\` (default with Bazel 7).
21+
2. Add to your \`MODULE.bazel\` file:
22+
23+
\`\`\`starlark
24+
bazel_dep(name = "bazel_jar_jar", version = "${TAG:1}")
25+
\`\`\`
26+
27+
## Using WORKSPACE
28+
29+
Paste this snippet into your \`WORKSPACE.bazel\` file:
30+
31+
\`\`\`starlark
32+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
33+
34+
http_archive(
35+
name = "bazel_jar_jar",
36+
sha256 = "${SHA}",
37+
strip_prefix = "${PREFIX}",
38+
url = "https://github.com/bazeltools/bazel_jar_jar/releases/download/${TAG}/${ARCHIVE}",
39+
)
40+
41+
load(
42+
"@com_github_johnynek_bazel_jar_jar//:jar_jar.bzl",
43+
"jar_jar_repositories",
44+
)
45+
46+
jar_jar_repositories()
47+
\`\`\`
48+
EOF

CONTRIBUTING.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Releasing
2+
3+
As one-time setup, follow the first step of https://github.com/bazel-contrib/publish-to-bcr#how-it-works.
4+
5+
1. Create an annotated tag with `git tag -a v1.2.3`, where the message will be used in the release notes.
6+
2. Push the tag with `git push origin v1.2.3` to trigger the creation of a GitHub pre-release as well as a Bazel Central Registry (BCR) PR.
7+
The PR will be associated with the GitHub account configured in `.bcr/config.yml`.
8+
3. Review the release notes on https://github.com/bazeltools/bazel_jar_jar/releases and mark the release as final.

0 commit comments

Comments
 (0)