# 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 # String containing submitters to tag SUBMITTERS: "@alexeagle, @kormide" TOKEN: ${{ secrets.BCR_ALEXEAGLE_PAT }} jobs: bcr-pull-request: runs-on: ubuntu-latest steps: - uses: actions/setup-node@v2 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: ${{ env.TOKEN }} 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 }} body: | [Automated] Publish ${{ github.repository }}@${{ steps.get_tag.outputs.TAG }}. Submitters: ${{ env.SUBMITTERS }} - name: Echo PR url run: echo ${{ steps.post_pr.outputs.pull-request-url }}