Skip to content

Commit e092948

Browse files
committed
chore: switch to use publish-to-bcr workflow
1 parent 46167f5 commit e092948

File tree

2 files changed

+69
-18
lines changed

2 files changed

+69
-18
lines changed

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# See https://github.com/bazel-contrib/publish-to-bcr
2+
name: Publish to BCR
3+
4+
on:
5+
# Run the publish workflow after a successful release
6+
# Can be triggered from the release.yaml workflow
7+
workflow_call:
8+
inputs:
9+
tag_name:
10+
required: true
11+
type: string
12+
secrets:
13+
BCR_PUBLISH_TOKEN:
14+
required: true
15+
# In case of problems, let release engineers retry by manually dispatching
16+
# the workflow from the GitHub UI
17+
workflow_dispatch:
18+
inputs:
19+
tag_name:
20+
required: true
21+
type: string
22+
23+
jobs:
24+
publish:
25+
uses: bazel-contrib/publish-to-bcr/.github/workflows/[email protected]
26+
with:
27+
draft: false
28+
tag_name: ${{ inputs.tag_name }}
29+
# GitHub repository which is a fork of the upstream where the Pull Request will be opened.
30+
registry_fork: bazel-contrib/bazel-central-registry
31+
attest: false
32+
permissions:
33+
contents: write
34+
secrets:
35+
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}

.github/workflows/release.yml

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,37 @@ jobs:
3535
uses: actions/checkout@v5
3636
- name: Create release archive and notes
3737
run: .github/workflows/create_archive_and_notes.sh
38-
- name: Publish wheel dist
39-
if: github.event_name == 'push' || github.event.inputs.publish_to_pypi
40-
env:
41-
# This special value tells pypi that the user identity is supplied within the token
42-
TWINE_USERNAME: __token__
43-
# Note, the PYPI_API_TOKEN is for the rules-python pypi user, added by @rickylev on
44-
# https://github.com/bazel-contrib/rules_python/settings/secrets/actions
45-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
46-
run: bazel run --stamp --embed_label=${{ github.ref_name }} //python/runfiles:wheel.publish
47-
- name: Release
48-
uses: softprops/action-gh-release@v2
49-
with:
50-
# Use GH feature to populate the changelog automatically
51-
generate_release_notes: true
52-
body_path: release_notes.txt
53-
prerelease: ${{ contains(github.ref, '-rc') }}
54-
fail_on_unmatched_files: true
55-
files: rules_python-*.tar.gz
38+
39+
release:
40+
name: Release
41+
uses: softprops/action-gh-release@v2
42+
with:
43+
# Use GH feature to populate the changelog automatically
44+
generate_release_notes: true
45+
body_path: release_notes.txt
46+
prerelease: ${{ contains(github.ref, '-rc') }}
47+
fail_on_unmatched_files: true
48+
files: rules_python-*.tar.gz
49+
50+
publish_bcr:
51+
name: Publish to BCR
52+
needs: release
53+
uses: .github/workflows/publish.yaml
54+
with:
55+
tag_name: ${{ github.ref_name }}
56+
secrets:
57+
BCR_PUBLISH_TOKEN: ${{ secrets.BCR_PUBLISH_TOKEN }}
58+
59+
publish_pypi:
60+
# We just want publish_pypi last, since once uploaded, it can't be changed.
61+
name: Publish runfiles to PyPI
62+
needs: publish_bcr
63+
runs-on: ubuntu-latest
64+
if: github.event_name == 'push' || github.event.inputs.publish_to_pypi
65+
env:
66+
# This special value tells pypi that the user identity is supplied within the token
67+
TWINE_USERNAME: __token__
68+
# Note, the PYPI_API_TOKEN is for the rules-python pypi user, added by @rickylev on
69+
# https://github.com/bazel-contrib/rules_python/settings/secrets/actions
70+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
71+
run: bazel run --stamp --embed_label=${{ github.ref_name }} //python/runfiles:wheel.publish

0 commit comments

Comments
 (0)