-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workflow that auto-publishes to our BCR fork
until we can publish to BCR again
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Add to rabbitmq/bazel-central-registry@erlang-packages | ||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
jobs: | ||
add-module: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: CHECKOUT | ||
uses: actions/checkout@v3 | ||
with: | ||
path: rules_erlang | ||
- name: CHECKOUT rabbitmq/bazel-central-registry@erlang-packages | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: rabbitmq/bazel-central-registry | ||
path: bazel-central-registry | ||
ref: erlang-packages | ||
- name: PUBLISH TO rabbitmq/bazel-central-registry@erlang-packages | ||
working-directory: bazel-central-registry | ||
env: | ||
MODULE_NAME: rules_erlang | ||
REPO_NAME: rules_erlang | ||
run: | | ||
VERSION="${{ github.ref_name }}" | ||
VERSION="${VERSION#v}" | ||
MAJOR="${VERSION:0:1}" | ||
echo "VERSION: ${VERSION}" | ||
echo "MAJOR: ${MAJOR}" | ||
cat << EOF > ${MODULE_NAME}.json | ||
{ | ||
"build_file": null, | ||
"build_targets": [ | ||
"@${MODULE_NAME}//..." | ||
], | ||
"compatibility_level": "${MAJOR}", | ||
"deps": [], | ||
"module_dot_bazel": "${{ github.workspace }}/${REPO_NAME}/MODULE.bazel", | ||
"name": "${MODULE_NAME}", | ||
"patch_strip": 0, | ||
"patches": [], | ||
"presubmit_yml": "${{ github.workspace }}/${REPO_NAME}/.bcr/presubmit.yml", | ||
"strip_prefix": "${REPO_NAME}-${VERSION}", | ||
"test_module_build_targets": [], | ||
"test_module_path": null, | ||
"test_module_test_targets": [], | ||
"url": "https://github.com/${{ github.repository }}/releases/download/${VERSION}/${REPO_NAME}-${VERSION}.tar.gz", | ||
"version": "${VERSION}" | ||
} | ||
EOF | ||
jq '.' ${MODULE_NAME}.json | ||
pip install -r tools/requirements_lock.txt | ||
python3 tools/add_module.py \ | ||
--input=${MODULE_NAME}.json | ||
git diff | ||
- name: CREATE PULL REQUEST | ||
uses: peter-evans/create-pull-request@v6.0.2 | ||
with: | ||
token: ${{ secrets.REPO_SCOPED_TOKEN }} | ||
path: bazel-central-registry | ||
title: Add ${{ github.repository }}@${{ github.ref_name }} | ||
body: > | ||
Automated changes created by | ||
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
using the [create-pull-request](https://github.com/peter-evans/create-pull-request) | ||
GitHub action in the ${{ github.workflow }} workflow. | ||
commit-message: | | ||
Add ${{ github.repository }}@${{ github.ref_name }} | ||
branch: add-${{ github.repository }}@${{ github.ref_name }} | ||
delete-branch: true |