ci: Improve release workflows (#638) · pbrns/crawlee-python@eb68e8c · GitHub
Skip to content

Commit eb68e8c

Browse files
authored
ci: Improve release workflows (apify#638)
- closes apify#469 - closes apify#706
1 parent b049606 commit eb68e8c

4 files changed

Lines changed: 63 additions & 27 deletions

File tree

‎.github/workflows/build_and_deploy_docs.yaml‎

Lines changed: 6 additions & 3 deletions

‎.github/workflows/pre_release.yaml‎

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
tags-ignore:
99
- "**" # Ignore all tags to prevent duplicate builds when tags are pushed.
1010

11+
concurrency:
12+
group: release
13+
cancel-in-progress: false
14+
1115
jobs:
1216
release_metadata:
1317
if: "!startsWith(github.event.head_commit.message, 'docs') && !startsWith(github.event.head_commit.message, 'ci') && startsWith(github.repository, 'apify/')"
@@ -24,28 +28,35 @@ jobs:
2428
with:
2529
release_type: prerelease
2630

27-
lint_check:
28-
name: Lint check
29-
uses: apify/workflows/.github/workflows/python_lint_check.yaml@main
30-
31-
type_check:
32-
name: Type check
33-
uses: apify/workflows/.github/workflows/python_type_check.yaml@main
34-
35-
unit_tests:
36-
name: Unit tests
37-
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main
31+
# If github.ref points to a [ci skip] commit, this workflow won't run.
32+
# Otherwise, these checks will be launched from the `run_code_checks` workflow.
33+
wait_for_checks:
34+
name: Wait for code checks to pass
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: lewagon/wait-on-check-action@v1.3.4
38+
with:
39+
ref: ${{ github.ref }}
40+
repo-token: ${{ secrets.GITHUB_TOKEN }}
41+
check-regexp: "( check| tests)$"
42+
wait-interval: 5
3843

3944
update_changelog:
4045
name: Update changelog
41-
needs: [release_metadata, lint_check, type_check, unit_tests]
46+
needs: [release_metadata, wait_for_checks]
4247
uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main
4348
with:
4449
version_number: ${{ needs.release_metadata.outputs.version_number }}
4550
changelog: ${{ needs.release_metadata.outputs.changelog }}
4651
secrets:
4752
APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
4853

54+
build_and_deploy_docs:
55+
needs: [update_changelog]
56+
uses: ./.github/workflows/build_and_deploy_docs.yaml
57+
with:
58+
ref: ${{ needs.update_changelog.outputs.changelog_commitish }}
59+
4960
publish_to_pypi:
5061
name: Publish to PyPI
5162
needs: [release_metadata, update_changelog]

‎.github/workflows/release.yaml‎

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ on:
2121
type: string
2222
default: ""
2323

24+
concurrency:
25+
group: release
26+
cancel-in-progress: false
27+
2428
jobs:
2529
release_metadata:
2630
name: Prepare release metadata
@@ -38,17 +42,19 @@ jobs:
3842
release_type: ${{ inputs.release_type }}
3943
custom_version: ${{ inputs.custom_version }}
4044

41-
lint_check:
42-
name: Lint check
43-
uses: apify/workflows/.github/workflows/python_lint_check.yaml@main
44-
45-
type_check:
46-
name: Type check
47-
uses: apify/workflows/.github/workflows/python_type_check.yaml@main
48-
49-
unit_tests:
50-
name: Unit tests
51-
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main
45+
# If github.ref points to a [ci skip] commit, we assume that it was added by the pre_release workflow,
46+
# which doesn't push the commit if code checks don't pass.
47+
# Otherwise, the checks will have been triggered by the `run_code_checks` workflow.
48+
wait_for_checks:
49+
name: Wait for code checks to pass
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: lewagon/wait-on-check-action@v1.3.4
53+
with:
54+
ref: ${{ github.ref }}
55+
repo-token: ${{ secrets.GITHUB_TOKEN }}
56+
check-regexp: "( check| tests)$"
57+
wait-interval: 5
5258

5359
update_changelog:
5460
name: Update changelog
@@ -60,6 +66,12 @@ jobs:
6066
secrets:
6167
APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
6268

69+
build_and_deploy_docs:
70+
needs: [update_changelog]
71+
uses: ./.github/workflows/build_and_deploy_docs.yaml
72+
with:
73+
ref: ${{ needs.update_changelog.outputs.changelog_commitish }}
74+
6375
create_github_release:
6476
name: Create github release
6577
needs: [release_metadata, update_changelog]

‎.github/workflows/run_code_checks.yaml‎

Lines changed: 11 additions & 1 deletion

0 commit comments

Comments
 (0)