|
21 | 21 | - "*.*.*" |
22 | 22 | workflow_dispatch: |
23 | 23 | inputs: |
| 24 | + tag_name: |
| 25 | + description: "release tag: tag that will be released" |
| 26 | + required: true |
| 27 | + type: string |
24 | 28 | publish_to_pypi: |
25 | 29 | description: 'Publish to PyPI' |
26 | 30 | required: true |
27 | 31 | type: boolean |
28 | 32 | default: true |
| 33 | + secrets: |
| 34 | + publish_token: |
| 35 | + required: false |
29 | 36 |
|
30 | 37 | jobs: |
31 | | - build: |
| 38 | + release: |
| 39 | + name: Release |
32 | 40 | runs-on: ubuntu-latest |
33 | 41 | steps: |
34 | 42 | - name: Checkout |
35 | 43 | uses: actions/checkout@v5 |
| 44 | + with: |
| 45 | + ref: ${{ github.ref_name }} |
36 | 46 | - name: Create release archive and notes |
37 | | - run: .github/workflows/create_archive_and_notes.sh |
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 |
| 47 | + run: .github/workflows/create_archive_and_notes.sh ${{ inputs.tag_name || github.ref_name }} |
| 48 | + - name: Release |
| 49 | + uses: softprops/action-gh-release@v2 |
| 50 | + with: |
| 51 | + # Use GH feature to populate the changelog automatically |
| 52 | + generate_release_notes: true |
| 53 | + body_path: release_notes.txt |
| 54 | + prerelease: ${{ contains( (inputs.tag_name || github.ref), '-rc') }} |
| 55 | + fail_on_unmatched_files: true |
| 56 | + files: rules_python-*.tar.gz |
| 57 | + tag_name: ${{ inputs.tag_name || github.ref_name }} |
49 | 58 |
|
50 | 59 | publish_bcr: |
51 | | - name: Publish to BCR |
52 | 60 | needs: release |
53 | | - uses: .github/workflows/publish.yaml |
| 61 | + uses: ./.github/workflows/publish.yml |
54 | 62 | with: |
55 | | - tag_name: ${{ github.ref_name }} |
| 63 | + tag_name: ${{ inputs.tag_name || github.ref_name }} |
56 | 64 | secrets: |
57 | | - BCR_PUBLISH_TOKEN: ${{ secrets.BCR_PUBLISH_TOKEN }} |
| 65 | + publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }} |
58 | 66 |
|
59 | 67 | publish_pypi: |
60 | 68 | # We just want publish_pypi last, since once uploaded, it can't be changed. |
61 | 69 | name: Publish runfiles to PyPI |
62 | 70 | needs: publish_bcr |
63 | 71 | 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 |
| 72 | + steps: |
| 73 | + - if: github.event_name == 'push' || github.event.inputs.publish_to_pypi |
| 74 | + env: |
| 75 | + # This special value tells pypi that the user identity is supplied within the token |
| 76 | + TWINE_USERNAME: __token__ |
| 77 | + # Note, the PYPI_API_TOKEN is for the rules-python pypi user, added by @rickylev on |
| 78 | + # https://github.com/bazel-contrib/rules_python/settings/secrets/actions |
| 79 | + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
| 80 | + run: bazel run --stamp --embed_label=${{ inputs.tag_name || github.ref_name }} //python/runfiles:wheel.publish |
0 commit comments