|
1 | 1 | name: CI (master) |
2 | 2 |
|
3 | 3 | on: |
4 | | - # Runs on every push to the master branch. |
5 | 4 | push: |
6 | 5 | branches: |
7 | 6 | - master |
8 | 7 | 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 |
10 | 13 |
|
11 | 14 | jobs: |
12 | 15 | doc_checks: |
13 | 16 | name: Doc checks |
14 | 17 | 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 }} |
15 | 28 | secrets: inherit |
16 | 29 |
|
17 | 30 | code_checks: |
18 | 31 | name: Code checks |
19 | 32 | uses: ./.github/workflows/_check_code.yaml |
20 | 33 |
|
21 | 34 | tests: |
| 35 | + # Skip this for "ci" and "docs" commits. |
| 36 | + if: "!startsWith(github.event.head_commit.message, 'ci') && !startsWith(github.event.head_commit.message, 'docs')" |
22 | 37 | name: Tests |
23 | 38 | uses: ./.github/workflows/_tests.yaml |
24 | 39 | secrets: inherit |
25 | 40 |
|
26 | | - pre_release: |
27 | | - name: Pre-release |
| 41 | + release_prepare: |
| 42 | + # Skip this for "ci", "docs" and "test" commits and for forks. |
| 43 | + 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/')" |
| 44 | + name: Release prepare |
28 | 45 | needs: [code_checks, tests] |
29 | | - uses: ./.github/workflows/_release_pre.yaml |
| 46 | + runs-on: ubuntu-latest |
| 47 | + outputs: |
| 48 | + version_number: ${{ steps.release_prepare.outputs.version_number }} |
| 49 | + tag_name: ${{ steps.release_prepare.outputs.tag_name }} |
| 50 | + changelog: ${{ steps.release_prepare.outputs.changelog }} |
| 51 | + steps: |
| 52 | + - uses: apify/workflows/git-cliff-release@main |
| 53 | + id: release_prepare |
| 54 | + name: Release prepare |
| 55 | + with: |
| 56 | + release_type: prerelease |
| 57 | + existing_changelog_path: CHANGELOG.md |
| 58 | + |
| 59 | + changelog_update: |
| 60 | + name: Changelog update |
| 61 | + needs: [release_prepare] |
| 62 | + uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main |
| 63 | + with: |
| 64 | + version_number: ${{ needs.release_prepare.outputs.version_number }} |
| 65 | + changelog: ${{ needs.release_prepare.outputs.changelog }} |
30 | 66 | secrets: inherit |
31 | 67 |
|
32 | | - release_docs: |
33 | | - name: Doc release |
34 | | - needs: [doc_checks, pre_release] |
| 68 | + pypi_publish: |
| 69 | + name: PyPI publish |
| 70 | + needs: [release_prepare, changelog_update] |
| 71 | + runs-on: ubuntu-latest |
| 72 | + permissions: |
| 73 | + contents: write |
| 74 | + id-token: write # Required for OIDC authentication. |
| 75 | + environment: |
| 76 | + name: pypi |
| 77 | + url: https://pypi.org/project/crawlee |
| 78 | + steps: |
| 79 | + - name: Prepare distribution |
| 80 | + uses: apify/workflows/prepare-pypi-distribution@main |
| 81 | + with: |
| 82 | + package_name: crawlee |
| 83 | + is_prerelease: "yes" |
| 84 | + version_number: ${{ needs.release_prepare.outputs.version_number }} |
| 85 | + ref: ${{ needs.changelog_update.outputs.changelog_commitish }} |
| 86 | + |
| 87 | + - name: Publish package to PyPI |
| 88 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 89 | + |
| 90 | + doc_release_post_publish: |
| 91 | + name: Doc release post publish |
| 92 | + needs: [changelog_update, pypi_publish] |
35 | 93 | uses: ./.github/workflows/_release_docs.yaml |
36 | 94 | with: |
37 | | - ref: ${{ needs.pre_release.outputs.changelog_commitish }} |
| 95 | + # Use the ref from the changelog update to include the updated changelog. |
| 96 | + ref: ${{ needs.changelog_update.outputs.changelog_commitish }} |
38 | 97 | secrets: inherit |
0 commit comments