|
| 1 | +name: Stable release |
| 2 | + |
| 3 | +on: |
| 4 | + # Runs when manually triggered from the GitHub UI, with options to specify the type of release. |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + release_type: |
| 8 | + description: Release type |
| 9 | + required: true |
| 10 | + type: choice |
| 11 | + default: auto |
| 12 | + options: |
| 13 | + - auto |
| 14 | + - custom |
| 15 | + - patch |
| 16 | + - minor |
| 17 | + - major |
| 18 | + custom_version: |
| 19 | + description: The custom version to bump to (only for "custom" type) |
| 20 | + required: false |
| 21 | + type: string |
| 22 | + default: "" |
| 23 | + |
| 24 | +concurrency: |
| 25 | + group: release |
| 26 | + cancel-in-progress: false |
| 27 | + |
| 28 | +jobs: |
| 29 | + code_checks: |
| 30 | + name: Code checks |
| 31 | + uses: ./.github/workflows/_check_code.yaml |
| 32 | + |
| 33 | + tests: |
| 34 | + name: Tests |
| 35 | + uses: ./.github/workflows/_tests.yaml |
| 36 | + |
| 37 | + release_prepare: |
| 38 | + name: Release prepare |
| 39 | + needs: [code_checks, tests] |
| 40 | + runs-on: ubuntu-latest |
| 41 | + outputs: |
| 42 | + version_number: ${{ steps.release_prepare.outputs.version_number }} |
| 43 | + tag_name: ${{ steps.release_prepare.outputs.tag_name }} |
| 44 | + changelog: ${{ steps.release_prepare.outputs.changelog }} |
| 45 | + release_notes: ${{ steps.release_prepare.outputs.release_notes }} |
| 46 | + steps: |
| 47 | + - uses: apify/workflows/git-cliff-release@main |
| 48 | + name: Release prepare |
| 49 | + id: release_prepare |
| 50 | + with: |
| 51 | + release_type: ${{ inputs.release_type }} |
| 52 | + custom_version: ${{ inputs.custom_version }} |
| 53 | + existing_changelog_path: CHANGELOG.md |
| 54 | + |
| 55 | + changelog_update: |
| 56 | + name: Changelog update |
| 57 | + needs: [release_prepare] |
| 58 | + uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main |
| 59 | + with: |
| 60 | + version_number: ${{ needs.release_prepare.outputs.version_number }} |
| 61 | + changelog: ${{ needs.release_prepare.outputs.changelog }} |
| 62 | + secrets: inherit |
| 63 | + |
| 64 | + github_release: |
| 65 | + name: GitHub release |
| 66 | + needs: [release_prepare, changelog_update] |
| 67 | + runs-on: ubuntu-latest |
| 68 | + env: |
| 69 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + steps: |
| 71 | + - name: GitHub release |
| 72 | + uses: softprops/action-gh-release@v2 |
| 73 | + with: |
| 74 | + tag_name: ${{ needs.release_prepare.outputs.tag_name }} |
| 75 | + name: ${{ needs.release_prepare.outputs.version_number }} |
| 76 | + target_commitish: ${{ needs.changelog_update.outputs.changelog_commitish }} |
| 77 | + body: ${{ needs.release_prepare.outputs.release_notes }} |
| 78 | + |
| 79 | + pypi_publish: |
| 80 | + name: PyPI publish |
| 81 | + needs: [release_prepare, changelog_update] |
| 82 | + runs-on: ubuntu-latest |
| 83 | + permissions: |
| 84 | + contents: write |
| 85 | + id-token: write # Required for OIDC authentication. |
| 86 | + environment: |
| 87 | + name: pypi |
| 88 | + url: https://pypi.org/project/apify-shared |
| 89 | + steps: |
| 90 | + - name: Prepare distribution |
| 91 | + uses: apify/workflows/prepare-pypi-distribution@main |
| 92 | + with: |
| 93 | + package_name: apify-shared |
| 94 | + is_prerelease: "" |
| 95 | + version_number: ${{ needs.release_prepare.outputs.version_number }} |
| 96 | + ref: ${{ needs.changelog_update.outputs.changelog_commitish }} |
| 97 | + |
| 98 | + # Publishes the package to PyPI using PyPA official GitHub action with OIDC authentication. |
| 99 | + - name: Publish package to PyPI |
| 100 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments