Skip to content

Commit 4cb9768

Browse files
committed
fix: inline beta release jobs to fix PyPI Trusted Publishing
PyPI's Trusted Publishing rejects OIDC tokens issued from reusable workflows, so the beta release jobs are inlined into on_master.yaml instead of being invoked via `uses:` from manual_release_beta.yaml.
1 parent 55e4041 commit 4cb9768

2 files changed

Lines changed: 53 additions & 7 deletions

File tree

.github/workflows/manual_release_beta.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ name: Beta release
22

33
on:
44
# Runs when manually triggered from the GitHub UI.
5+
# Note: This workflow is intentionally NOT a reusable workflow (no `workflow_call`)
6+
# because PyPI's Trusted Publishing does not currently support reusable workflows.
7+
# The same jobs are duplicated in `on_master.yaml` for the automatic beta release on push to master.
8+
# See: https://docs.pypi.org/trusted-publishers/troubleshooting/#reusable-workflows-on-github
59
workflow_dispatch:
610

7-
# Runs when invoked by another workflow.
8-
workflow_call:
9-
1011
permissions:
1112
contents: read
1213

.github/workflows/on_master.yaml

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,58 @@ jobs:
2222
name: Tests
2323
uses: ./.github/workflows/_tests.yaml
2424

25-
beta_release:
25+
# The beta release jobs are intentionally inlined here (instead of calling
26+
# `manual_release_beta.yaml` via `uses:`) because PyPI's Trusted Publishing
27+
# does not currently support reusable workflows.
28+
# See: https://docs.pypi.org/trusted-publishers/troubleshooting/#reusable-workflows-on-github
29+
release_prepare:
2630
# Skip this for "ci", "docs" and "test" commits and for forks.
2731
if: "!startsWith(github.event.head_commit.message, 'ci') && !startsWith(github.event.head_commit.message, 'docs') && !startsWith(github.event.head_commit.message, 'test') && startsWith(github.repository, 'apify/')"
28-
name: Beta release
32+
name: Beta release / Release prepare
2933
needs: [code_checks, tests]
34+
runs-on: ubuntu-latest
35+
outputs:
36+
version_number: ${{ steps.release_prepare.outputs.version_number }}
37+
tag_name: ${{ steps.release_prepare.outputs.tag_name }}
38+
changelog: ${{ steps.release_prepare.outputs.changelog }}
39+
steps:
40+
- uses: apify/workflows/git-cliff-release@main
41+
id: release_prepare
42+
name: Release prepare
43+
with:
44+
release_type: prerelease
45+
existing_changelog_path: CHANGELOG.md
46+
47+
changelog_update:
48+
name: Beta release / Changelog update
49+
needs: [release_prepare]
3050
permissions:
3151
contents: write
32-
id-token: write
33-
uses: ./.github/workflows/manual_release_beta.yaml
52+
uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main
53+
with:
54+
version_number: ${{ needs.release_prepare.outputs.version_number }}
55+
changelog: ${{ needs.release_prepare.outputs.changelog }}
3456
secrets: inherit
57+
58+
pypi_publish:
59+
name: Beta release / PyPI publish
60+
needs: [release_prepare, changelog_update]
61+
runs-on: ubuntu-latest
62+
permissions:
63+
contents: write
64+
id-token: write # Required for OIDC authentication.
65+
environment:
66+
name: pypi
67+
url: https://pypi.org/project/apify-shared
68+
steps:
69+
- name: Prepare distribution
70+
uses: apify/workflows/prepare-pypi-distribution@main
71+
with:
72+
package_name: apify-shared
73+
is_prerelease: "yes"
74+
version_number: ${{ needs.release_prepare.outputs.version_number }}
75+
ref: ${{ needs.changelog_update.outputs.changelog_commitish }}
76+
77+
# Publish the package to PyPI using PyPA official GitHub action with OIDC authentication.
78+
- name: Publish package to PyPI
79+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)