Skip to content

Commit 92c6f39

Browse files
committed
Add a workflow that auto-publishes to our BCR fork
until we can publish to BCR again
1 parent 36c55cc commit 92c6f39

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Add to rabbitmq/bazel-central-registry@erlang-packages
2+
on:
3+
release:
4+
types: [published]
5+
workflow_dispatch:
6+
jobs:
7+
add-module:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: CHECKOUT
11+
uses: actions/checkout@v3
12+
with:
13+
path: rules_erlang
14+
- name: CHECKOUT rabbitmq/bazel-central-registry@erlang-packages
15+
uses: actions/checkout@v3
16+
with:
17+
repository: rabbitmq/bazel-central-registry
18+
path: bazel-central-registry
19+
ref: erlang-packages
20+
- name: PUBLISH TO rabbitmq/bazel-central-registry@erlang-packages
21+
working-directory: bazel-central-registry
22+
env:
23+
MODULE_NAME: rules_erlang
24+
REPO_NAME: rules_erlang
25+
run: |
26+
VERSION="${{ github.ref_name }}"
27+
VERSION="${VERSION#v}"
28+
MAJOR="${VERSION:0:1}"
29+
30+
echo "VERSION: ${VERSION}"
31+
echo "MAJOR: ${MAJOR}"
32+
33+
cat << EOF > ${MODULE_NAME}.json
34+
{
35+
"build_file": null,
36+
"build_targets": [
37+
"@${MODULE_NAME}//..."
38+
],
39+
"compatibility_level": "${MAJOR}",
40+
"deps": [],
41+
"module_dot_bazel": "${{ github.workspace }}/${REPO_NAME}/MODULE.bazel",
42+
"name": "${MODULE_NAME}",
43+
"patch_strip": 0,
44+
"patches": [],
45+
"presubmit_yml": "${{ github.workspace }}/${REPO_NAME}/.bcr/presubmit.yml",
46+
"strip_prefix": "${REPO_NAME}-${VERSION}",
47+
"test_module_build_targets": [],
48+
"test_module_path": null,
49+
"test_module_test_targets": [],
50+
"url": "https://github.com/${{ github.repository }}/releases/download/${VERSION}/${REPO_NAME}-${VERSION}.tar.gz",
51+
"version": "${VERSION}"
52+
}
53+
EOF
54+
55+
jq '.' ${MODULE_NAME}.json
56+
57+
pip install -r tools/requirements_lock.txt
58+
python3 tools/add_module.py \
59+
--input=${MODULE_NAME}.json
60+
61+
git diff
62+
- name: CREATE PULL REQUEST
63+
uses: peter-evans/[email protected]
64+
with:
65+
token: ${{ secrets.REPO_SCOPED_TOKEN }}
66+
path: bazel-central-registry
67+
title: Add ${{ github.repository }}@${{ github.ref_name }}
68+
body: >
69+
Automated changes created by
70+
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
71+
using the [create-pull-request](https://github.com/peter-evans/create-pull-request)
72+
GitHub action in the ${{ github.workflow }} workflow.
73+
commit-message: |
74+
Add ${{ github.repository }}@${{ github.ref_name }}
75+
branch: add-${{ github.repository }}@${{ github.ref_name }}
76+
delete-branch: true

0 commit comments

Comments
 (0)