|
| 1 | +name: CI (master) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + tags-ignore: |
| 8 | + - "**" # Ignore all tags to avoid duplicate executions triggered by tag pushes. |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: release |
| 12 | + cancel-in-progress: false |
| 13 | + |
| 14 | +jobs: |
| 15 | + doc_checks: |
| 16 | + name: Doc checks |
| 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 }} |
| 28 | + secrets: inherit |
| 29 | + |
| 30 | + code_checks: |
| 31 | + name: Code checks |
| 32 | + uses: ./.github/workflows/_check_code.yaml |
| 33 | + |
| 34 | + docstrings_checks: |
| 35 | + name: Docstrings checks |
| 36 | + uses: ./.github/workflows/_check_docstrings.yaml |
| 37 | + |
| 38 | + 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')" |
| 41 | + name: Tests |
| 42 | + uses: ./.github/workflows/_tests.yaml |
| 43 | + secrets: inherit |
| 44 | + |
| 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 }} |
| 70 | + secrets: inherit |
| 71 | + |
| 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] |
| 97 | + uses: ./.github/workflows/_release_docs.yaml |
| 98 | + with: |
| 99 | + # Use the ref from the changelog update to include the updated changelog. |
| 100 | + ref: ${{ needs.changelog_update.outputs.changelog_commitish }} |
| 101 | + secrets: inherit |
0 commit comments