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