11name : CI (master)
22
33on :
4- # Runs on every push to the master branch.
54 push :
65 branches :
76 - master
87 tags-ignore :
9- - " **" # Ignore all tags to avoid duplicate executions triggered by tag pushes.
8+ - " **" # Ignore all tags to avoid duplicate executions triggered by tag pushes.
9+
10+ concurrency :
11+ group : release
12+ cancel-in-progress : false
1013
1114jobs :
1215 doc_checks :
1316 name : Doc checks
1417 uses : ./.github/workflows/_check_docs.yaml
18+
19+ doc_release :
20+ # Skip this for non-docs commits and forks.
21+ if : " startsWith(github.event.head_commit.message, 'docs') && startsWith(github.repository, 'apify/')"
22+ name : Doc release
23+ needs : [doc_checks]
24+ uses : ./.github/workflows/_release_docs.yaml
25+ with :
26+ # Use the same ref as the one that triggered the workflow.
27+ ref : ${{ github.ref }}
1528 secrets : inherit
1629
1730 code_checks :
@@ -23,20 +36,66 @@ jobs:
2336 uses : ./.github/workflows/_check_docstrings.yaml
2437
2538 tests :
39+ # Skip this for "ci" and "docs" commits.
40+ if : " !startsWith(github.event.head_commit.message, 'ci') && !startsWith(github.event.head_commit.message, 'docs')"
2641 name : Tests
2742 uses : ./.github/workflows/_tests.yaml
2843 secrets : inherit
2944
30- pre_release :
31- name : Pre-release
32- needs : [code_checks, tests]
33- uses : ./.github/workflows/_release_pre.yaml
45+ release_prepare :
46+ # Skip this for "ci", "docs" and "test" commits and for forks.
47+ 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/')"
48+ name : Release prepare
49+ needs : [code_checks, docstrings_checks, tests]
50+ runs-on : ubuntu-latest
51+ outputs :
52+ version_number : ${{ steps.release_prepare.outputs.version_number }}
53+ tag_name : ${{ steps.release_prepare.outputs.tag_name }}
54+ changelog : ${{ steps.release_prepare.outputs.changelog }}
55+ steps :
56+ - uses : apify/workflows/git-cliff-release@main
57+ id : release_prepare
58+ name : Release prepare
59+ with :
60+ release_type : prerelease
61+ existing_changelog_path : CHANGELOG.md
62+
63+ changelog_update :
64+ name : Changelog update
65+ needs : [release_prepare]
66+ uses : apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main
67+ with :
68+ version_number : ${{ needs.release_prepare.outputs.version_number }}
69+ changelog : ${{ needs.release_prepare.outputs.changelog }}
3470 secrets : inherit
3571
36- release_docs :
37- name : Doc release
38- needs : [doc_checks, pre_release]
72+ pypi_publish :
73+ name : PyPI publish
74+ needs : [release_prepare, changelog_update]
75+ runs-on : ubuntu-latest
76+ permissions :
77+ contents : write
78+ id-token : write # Required for OIDC authentication.
79+ environment :
80+ name : pypi
81+ url : https://pypi.org/project/apify-client
82+ steps :
83+ - name : Prepare distribution
84+ uses : apify/workflows/prepare-pypi-distribution@main
85+ with :
86+ package_name : apify-client
87+ is_prerelease : " yes"
88+ version_number : ${{ needs.release_prepare.outputs.version_number }}
89+ ref : ${{ needs.changelog_update.outputs.changelog_commitish }}
90+
91+ - name : Publish package to PyPI
92+ uses : pypa/gh-action-pypi-publish@release/v1
93+
94+ doc_release_post_publish :
95+ name : Doc release post publish
96+ needs : [changelog_update, pypi_publish]
3997 uses : ./.github/workflows/_release_docs.yaml
4098 with :
41- ref : ${{ needs.pre_release.outputs.changelog_commitish }}
99+ # Use the ref from the changelog update to include the updated changelog.
100+ ref : ${{ needs.changelog_update.outputs.changelog_commitish }}
42101 secrets : inherit
0 commit comments