Skip to content

Commit

Permalink
Merge pull request #390 from rabbitmq/publish_bcr
Browse files Browse the repository at this point in the history
Add a release workflow for publishing to bazel-central-registry
  • Loading branch information
HoloRin authored Aug 17, 2023
2 parents 004d72e + 56d63b3 commit 54860c4
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 4 deletions.
Empty file added .bcr/config.yml
Empty file.
20 changes: 20 additions & 0 deletions .bcr/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"homepage": "https://github.com/rabbitmq/ra",
"maintainers": [
{
"email": "[email protected]",
"github": "kjnilsson",
"name": "Karl Nilsson"
},
{
"email": "[email protected]",
"github": "pjk25",
"name": "Rin Kuryloski"
}
],
"repository": [
"github:rabbitmq/ra"
],
"versions": [],
"yanked_versions": {}
}
27 changes: 27 additions & 0 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
shell_commands: &shell_commands
- curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
- chmod a+x kerl
- ./kerl update releases
- ./kerl build ${ERLANG_VERSION}
- ./kerl install ${ERLANG_VERSION} ~/kerl/${ERLANG_VERSION}
- realpath ~/kerl/${ERLANG_VERSION}

platforms:
macos:
environment:
ERLANG_VERSION: "25.0"
ERLANG_HOME: /Users/buildkite/kerl/25.0
shell_commands: *shell_commands
build_flags:
- --incompatible_strict_action_env
build_targets:
- '@rabbitmq_ra//:erlang_app'
ubuntu2004:
environment:
ERLANG_VERSION: "25.0"
ERLANG_HOME: /var/lib/buildkite-agent/kerl/25.0
shell_commands: *shell_commands
build_flags:
- --incompatible_strict_action_env
build_targets:
- '@rabbitmq_ra//:erlang_app'
5 changes: 5 additions & 0 deletions .bcr/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"integrity": "",
"strip_prefix": "{REPO}-{VERSION}",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/ra-{VERSION}.tar.gz"
}
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release
on:
push:
tags:
- v2.*
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: CHECKOUT
uses: actions/checkout@v3
with:
path: ra
- name: ASSERT VERSIONS
id: versions
working-directory: ra
run: |
sudo npm install --global --silent @bazel/buildozer
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)"
if [[ "${{ github.ref_name }}" != "v$VERSION_APP_SRC" ]]; then
echo "Version in src/ra.app.src ($VERSION_APP_SRC) does not match tag (${{ github.ref_name }})"
exit 1
fi
VERSION_BAZEL="$(cat MODULE.bazel | buildozer 'print version' -:%module)"
if [[ "${{ github.ref_name }}" != "v$VERSION_BAZEL" ]]; then
echo "Version in MODULE.bazel ($VERSION_BAZEL) does not match tag (${{ github.ref_name }})"
exit 1
fi
echo "version=$VERSION_BAZEL" | tee -a $GITHUB_OUTPUT
- name: FETCH THE SOURCE ARCHIVE
run: |
curl \
-L \
-o ra-${{ steps.versions.outputs.version }}.tar.gz \
https://github.com/${{ github.repository }}/archive/${{ github.ref }}.tar.gz
- name: CREATE RELEASE
id: create-release
uses: ncipollo/[email protected]
with:
allowUpdates: true
draft: true
artifactErrorsFailBuild: true
updateOnlyUnreleased: true
generateReleaseNotes: true
artifacts: >-
ra-${{ steps.versions.outputs.version }}.tar.gz
8 changes: 4 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module(
name = "ra",
version = "2.4.0",
name = "rabbitmq_ra",
version = "2.6.3",
)

bazel_dep(
name = "rules_erlang",
version = "3.10.5",
version = "3.11.4",
)

erlang_config = use_extension(
Expand Down Expand Up @@ -94,7 +94,7 @@ erlang_dev_package = use_extension(
erlang_package.hex_package(
name = "eunit_formatters",
version = "0.5.0",
build_file = "@ra//bzl:BUILD.eunit_formatters",
build_file = "@rabbitmq_ra//bzl:BUILD.eunit_formatters",
)

use_repo(
Expand Down
2 changes: 2 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
workspace(name = "rabbitmq_ra")

load(
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive",
Expand Down

0 comments on commit 54860c4

Please sign in to comment.