2
0
Fork 0
mirror of https://github.com/bazel-contrib/bazel-lib synced 2024-11-30 01:41:21 +00:00
bazel-lib/.github/workflows/bcr.yml

69 lines
2.4 KiB
YAML

# GitHub Actions workflow to create a pull request to update the bazel central
# registry after a successful release.
#
# Usage:
# 1. Fork bazelbuild/bazel-central-registry to your org or personal account.
# 2. Set the workflow env variables below (see instructions for each variable).
# 3. Update the following files in .github/workflows/bcr to be relevant for your
# project:
# - presubmit.yml
# - metadata.template.json
# - source.template.json
# See https://docs.bazel.build/versions/main/bzlmod.html#bazel-central-registry
# for more information.
# 4. A PR will be posted from your fork to bazelbuild/bazel-central-registry
# with an updated module entry after a successful release.
name: BCR
on:
release:
types: [published]
env:
# Bazel central registry to post a pull request to.
BCR: bazelbuild/bazel-central-registry
# Fork of the bazel central registery to push the pull request branch to
BCR_FORK: aspect-build/bazel-central-registry
jobs:
bcr-pull-request:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: "14"
- name: Get the tag
id: get_tag
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
- name: Checkout this repo to access scripts
uses: actions/checkout@v3
- name: Checkout the released version of this repo
uses: actions/checkout@v3
with:
ref: ${{ env.GITHUB_REF }}
path: project
- name: Checkout bcr
uses: actions/checkout@v3
with:
repository: ${{ env.BCR }}
path: bcr
- name: Create bcr entry
run: node .github/workflows/create-bcr-entry.mjs project bcr $GITHUB_REPOSITORY ${{ steps.get_tag.outputs.TAG }}
- name: Create Pull Request
id: post_pr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.DEREK_BCR_PAT }}
path: bcr
push-to-fork: ${{ env.BCR_FORK }}
commit-message: ${{ github.repository }}@${{ steps.get_tag.outputs.TAG }}
branch: ${{ github.repository }}@${{ steps.get_tag.outputs.TAG }}
title: ${{ github.repository }}@${{ steps.get_tag.outputs.TAG }}
assignees: ${{ github.actor }}
body: |
[Automated] Publish ${{ github.repository }}@${{ steps.get_tag.outputs.TAG }}.
- name: Echo PR url
run: echo ${{ steps.post_pr.outputs.pull-request-url }}