Skip to content

Commit 6958fc5

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

File tree

2 files changed

+52
-9
lines changed

2 files changed

+52
-9
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/publish.yaml@v1.0.0
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: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,7 @@ 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
38+
release:
4739
- name: Release
4840
uses: softprops/action-gh-release@v2
4941
with:
@@ -53,3 +45,19 @@ jobs:
5345
prerelease: ${{ contains(github.ref, '-rc') }}
5446
fail_on_unmatched_files: true
5547
files: rules_python-*.tar.gz
48+
- name: Publish runfiles to PyPI
49+
if: github.event_name == 'push' || github.event.inputs.publish_to_pypi
50+
env:
51+
# This special value tells pypi that the user identity is supplied within the token
52+
TWINE_USERNAME: __token__
53+
# Note, the PYPI_API_TOKEN is for the rules-python pypi user, added by @rickylev on
54+
# https://github.com/bazel-contrib/rules_python/settings/secrets/actions
55+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
56+
run: bazel run --stamp --embed_label=${{ github.ref_name }} //python/runfiles:wheel.publish
57+
publish_bcr:
58+
needs: build
59+
uses: .github/workflows/publish.yaml
60+
with:
61+
tag_name: ${{ github.ref_name }}
62+
secrets:
63+
BCR_PUBLISH_TOKEN: ${{ secrets.BCR_PUBLISH_TOKEN }}

0 commit comments

Comments
 (0)