Skip to content

Commit 94d5bf4

Browse files
authored
ci: add manually triggerable beta release workflow (#775)
## Summary - Extract the beta release pipeline (`release_prepare` → `changelog_update` → `pypi_publish` → `doc_release_post_publish`) from `on_master.yaml` into a new `manual_release_beta.yaml` reusable workflow. - The new workflow exposes both `workflow_dispatch` (manual trigger from the GitHub UI) and `workflow_call` (so `on_master` can keep auto-publishing betas after master pushes). - `on_master.yaml` now has a single `beta_release` job that calls the new workflow, gated on the same `feat|fix|perf|refactor|style:` commit prefixes and on `code_checks` + `docstrings_checks` + `tests` passing. ## Why We previously had no way to cut a beta without pushing a release-triggering commit to master. With this change, a beta can be released on demand from the Actions tab, while the existing automatic flow on master is preserved. Mirrors apify/apify-sdk-python#886.
1 parent 64998e8 commit 94d5bf4

2 files changed

Lines changed: 78 additions & 56 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Beta release
2+
3+
on:
4+
# Runs when manually triggered from the GitHub UI.
5+
workflow_dispatch:
6+
7+
# Runs when invoked by another workflow.
8+
workflow_call:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
release_prepare:
15+
name: Release prepare
16+
runs-on: ubuntu-latest
17+
outputs:
18+
version_number: ${{ steps.release_prepare.outputs.version_number }}
19+
tag_name: ${{ steps.release_prepare.outputs.tag_name }}
20+
changelog: ${{ steps.release_prepare.outputs.changelog }}
21+
steps:
22+
- uses: apify/workflows/git-cliff-release@main
23+
id: release_prepare
24+
name: Release prepare
25+
with:
26+
release_type: prerelease
27+
existing_changelog_path: CHANGELOG.md
28+
29+
changelog_update:
30+
name: Changelog update
31+
needs: [release_prepare]
32+
permissions:
33+
contents: write
34+
uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main
35+
with:
36+
version_number: ${{ needs.release_prepare.outputs.version_number }}
37+
changelog: ${{ needs.release_prepare.outputs.changelog }}
38+
secrets: inherit
39+
40+
pypi_publish:
41+
name: PyPI publish
42+
needs: [release_prepare, changelog_update]
43+
runs-on: ubuntu-latest
44+
permissions:
45+
contents: write
46+
id-token: write # Required for OIDC authentication.
47+
environment:
48+
name: pypi
49+
url: https://pypi.org/project/apify-client
50+
steps:
51+
- name: Prepare distribution
52+
uses: apify/workflows/prepare-pypi-distribution@main
53+
with:
54+
package_name: apify-client
55+
is_prerelease: "yes"
56+
version_number: ${{ needs.release_prepare.outputs.version_number }}
57+
ref: ${{ needs.changelog_update.outputs.changelog_commitish }}
58+
59+
# Publish the package to PyPI using PyPA official GitHub action with OIDC authentication.
60+
- name: Publish package to PyPI
61+
uses: pypa/gh-action-pypi-publish@release/v1
62+
63+
doc_release_post_publish:
64+
name: Doc release post publish
65+
needs: [changelog_update, pypi_publish]
66+
permissions:
67+
contents: write
68+
pages: write
69+
id-token: write
70+
uses: ./.github/workflows/manual_release_docs.yaml
71+
with:
72+
# Use the ref from the changelog update to include the updated changelog.
73+
ref: ${{ needs.changelog_update.outputs.changelog_commitish }}
74+
secrets: inherit

.github/workflows/on_master.yaml

Lines changed: 4 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -49,71 +49,19 @@ jobs:
4949
uses: ./.github/workflows/_tests.yaml
5050
secrets: inherit
5151

52-
release_prepare:
52+
beta_release:
5353
# Run this only for "feat", "fix", "perf", "refactor" and "style" commits.
5454
if: >-
5555
startsWith(github.event.head_commit.message, 'feat') ||
5656
startsWith(github.event.head_commit.message, 'fix') ||
5757
startsWith(github.event.head_commit.message, 'perf') ||
5858
startsWith(github.event.head_commit.message, 'refactor') ||
5959
startsWith(github.event.head_commit.message, 'style')
60-
name: Release prepare
60+
name: Beta release
6161
needs: [code_checks, docstrings_checks, tests]
62-
runs-on: ubuntu-latest
63-
outputs:
64-
version_number: ${{ steps.release_prepare.outputs.version_number }}
65-
tag_name: ${{ steps.release_prepare.outputs.tag_name }}
66-
changelog: ${{ steps.release_prepare.outputs.changelog }}
67-
steps:
68-
- uses: apify/workflows/git-cliff-release@main
69-
id: release_prepare
70-
name: Release prepare
71-
with:
72-
release_type: prerelease
73-
existing_changelog_path: CHANGELOG.md
74-
75-
changelog_update:
76-
name: Changelog update
77-
needs: [release_prepare]
78-
permissions:
79-
contents: write
80-
uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main
81-
with:
82-
version_number: ${{ needs.release_prepare.outputs.version_number }}
83-
changelog: ${{ needs.release_prepare.outputs.changelog }}
84-
secrets: inherit
85-
86-
pypi_publish:
87-
name: PyPI publish
88-
needs: [release_prepare, changelog_update]
89-
runs-on: ubuntu-latest
90-
permissions:
91-
contents: write
92-
id-token: write # Required for OIDC authentication.
93-
environment:
94-
name: pypi
95-
url: https://pypi.org/project/apify-client
96-
steps:
97-
- name: Prepare distribution
98-
uses: apify/workflows/prepare-pypi-distribution@main
99-
with:
100-
package_name: apify-client
101-
is_prerelease: "yes"
102-
version_number: ${{ needs.release_prepare.outputs.version_number }}
103-
ref: ${{ needs.changelog_update.outputs.changelog_commitish }}
104-
105-
- name: Publish package to PyPI
106-
uses: pypa/gh-action-pypi-publish@release/v1
107-
108-
doc_release_post_publish:
109-
name: Doc release post publish
110-
needs: [changelog_update, pypi_publish]
11162
permissions:
11263
contents: write
113-
pages: write
11464
id-token: write
115-
uses: ./.github/workflows/manual_release_docs.yaml
116-
with:
117-
# Use the ref from the changelog update to include the updated changelog.
118-
ref: ${{ needs.changelog_update.outputs.changelog_commitish }}
65+
pages: write
66+
uses: ./.github/workflows/manual_release_beta.yaml
11967
secrets: inherit

0 commit comments

Comments
 (0)