Skip to content

Commit 54860c4

Browse files
authored
Merge pull request #390 from rabbitmq/publish_bcr
Add a release workflow for publishing to bazel-central-registry
2 parents 004d72e + 56d63b3 commit 54860c4

File tree

7 files changed

+109
-4
lines changed

7 files changed

+109
-4
lines changed

.bcr/config.yml

Whitespace-only changes.

.bcr/metadata.template.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"homepage": "https://github.com/rabbitmq/ra",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "kjnilsson",
7+
"name": "Karl Nilsson"
8+
},
9+
{
10+
"email": "[email protected]",
11+
"github": "pjk25",
12+
"name": "Rin Kuryloski"
13+
}
14+
],
15+
"repository": [
16+
"github:rabbitmq/ra"
17+
],
18+
"versions": [],
19+
"yanked_versions": {}
20+
}

.bcr/presubmit.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
shell_commands: &shell_commands
2+
- curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
3+
- chmod a+x kerl
4+
- ./kerl update releases
5+
- ./kerl build ${ERLANG_VERSION}
6+
- ./kerl install ${ERLANG_VERSION} ~/kerl/${ERLANG_VERSION}
7+
- realpath ~/kerl/${ERLANG_VERSION}
8+
9+
platforms:
10+
macos:
11+
environment:
12+
ERLANG_VERSION: "25.0"
13+
ERLANG_HOME: /Users/buildkite/kerl/25.0
14+
shell_commands: *shell_commands
15+
build_flags:
16+
- --incompatible_strict_action_env
17+
build_targets:
18+
- '@rabbitmq_ra//:erlang_app'
19+
ubuntu2004:
20+
environment:
21+
ERLANG_VERSION: "25.0"
22+
ERLANG_HOME: /var/lib/buildkite-agent/kerl/25.0
23+
shell_commands: *shell_commands
24+
build_flags:
25+
- --incompatible_strict_action_env
26+
build_targets:
27+
- '@rabbitmq_ra//:erlang_app'

.bcr/source.template.json

Lines changed: 5 additions & 0 deletions
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}/ra-{VERSION}.tar.gz"
5+
}

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- v2.*
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: CHECKOUT
11+
uses: actions/checkout@v3
12+
with:
13+
path: ra
14+
- name: ASSERT VERSIONS
15+
id: versions
16+
working-directory: ra
17+
run: |
18+
sudo npm install --global --silent @bazel/buildozer
19+
20+
VERSION_APP_SRC="$(erl -eval '{ok, [{application, _, AppInfo}]} = file:consult("src/ra.app.src"), Version = proplists:get_value(vsn, AppInfo), io:fwrite(Version), halt().' -noshell)"
21+
22+
if [[ "${{ github.ref_name }}" != "v$VERSION_APP_SRC" ]]; then
23+
echo "Version in src/ra.app.src ($VERSION_APP_SRC) does not match tag (${{ github.ref_name }})"
24+
exit 1
25+
fi
26+
27+
VERSION_BAZEL="$(cat MODULE.bazel | buildozer 'print version' -:%module)"
28+
29+
if [[ "${{ github.ref_name }}" != "v$VERSION_BAZEL" ]]; then
30+
echo "Version in MODULE.bazel ($VERSION_BAZEL) does not match tag (${{ github.ref_name }})"
31+
exit 1
32+
fi
33+
34+
echo "version=$VERSION_BAZEL" | tee -a $GITHUB_OUTPUT
35+
- name: FETCH THE SOURCE ARCHIVE
36+
run: |
37+
curl \
38+
-L \
39+
-o ra-${{ steps.versions.outputs.version }}.tar.gz \
40+
https://github.com/${{ github.repository }}/archive/${{ github.ref }}.tar.gz
41+
- name: CREATE RELEASE
42+
id: create-release
43+
uses: ncipollo/[email protected]
44+
with:
45+
allowUpdates: true
46+
draft: true
47+
artifactErrorsFailBuild: true
48+
updateOnlyUnreleased: true
49+
generateReleaseNotes: true
50+
artifacts: >-
51+
ra-${{ steps.versions.outputs.version }}.tar.gz

MODULE.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module(
2-
name = "ra",
3-
version = "2.4.0",
2+
name = "rabbitmq_ra",
3+
version = "2.6.3",
44
)
55

66
bazel_dep(
77
name = "rules_erlang",
8-
version = "3.10.5",
8+
version = "3.11.4",
99
)
1010

1111
erlang_config = use_extension(
@@ -94,7 +94,7 @@ erlang_dev_package = use_extension(
9494
erlang_package.hex_package(
9595
name = "eunit_formatters",
9696
version = "0.5.0",
97-
build_file = "@ra//bzl:BUILD.eunit_formatters",
97+
build_file = "@rabbitmq_ra//bzl:BUILD.eunit_formatters",
9898
)
9999

100100
use_repo(

WORKSPACE.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
workspace(name = "rabbitmq_ra")
2+
13
load(
24
"@bazel_tools//tools/build_defs/repo:http.bzl",
35
"http_archive",

0 commit comments

Comments
 (0)