From 03fad86b69086b1eed174b315d84981fc61586d3 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Sun, 14 Dec 2025 17:57:13 +0100 Subject: [PATCH 1/7] chore(ci): Align GitHub workflows across Python projects --- .github/workflows/pre_release.yaml | 6 +++++- .github/workflows/run_code_checks.yaml | 15 ++++++++++++--- .github/workflows/update_new_issue.yaml | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pre_release.yaml b/.github/workflows/pre_release.yaml index 2726dfb..6cd4509 100644 --- a/.github/workflows/pre_release.yaml +++ b/.github/workflows/pre_release.yaml @@ -11,6 +11,10 @@ on: # Or it can be triggered manually. workflow_dispatch: +concurrency: + group: release + cancel-in-progress: false + jobs: release_metadata: if: "!startsWith(github.event.head_commit.message, 'docs') && !startsWith(github.event.head_commit.message, 'ci') && startsWith(github.repository, 'apify/')" @@ -44,7 +48,7 @@ jobs: publish_to_pypi: name: Publish to PyPI - needs: [release_metadata, update_changelog] + needs: [release_metadata, run_code_checks, update_changelog] runs-on: ubuntu-latest permissions: contents: write diff --git a/.github/workflows/run_code_checks.yaml b/.github/workflows/run_code_checks.yaml index c70e989..0a27d9f 100644 --- a/.github/workflows/run_code_checks.yaml +++ b/.github/workflows/run_code_checks.yaml @@ -15,20 +15,29 @@ on: workflow_call: jobs: + actions_lint_check: + name: Actions lint check + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + - name: Run actionlint + uses: rhysd/actionlint@v1.7.9 + lint_check: name: Lint check uses: apify/workflows/.github/workflows/python_lint_check.yaml@main with: - python-versions: '["3.10", "3.11", "3.12", "3.13"]' + python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' type_check: name: Type check uses: apify/workflows/.github/workflows/python_type_check.yaml@main with: - python-versions: '["3.10", "3.11", "3.12", "3.13"]' + python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' unit_tests: name: Unit tests uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main with: - python-versions: '["3.10", "3.11", "3.12", "3.13"]' + python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' diff --git a/.github/workflows/update_new_issue.yaml b/.github/workflows/update_new_issue.yaml index 1b65db0..7946544 100644 --- a/.github/workflows/update_new_issue.yaml +++ b/.github/workflows/update_new_issue.yaml @@ -22,4 +22,4 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, labels: ["t-tooling"] - }) \ No newline at end of file + }) From 731477308623f7ad11afb865e90629a96be92a8b Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Sun, 14 Dec 2025 18:12:29 +0100 Subject: [PATCH 2/7] Fix run code checks --- .github/workflows/run_code_checks.yaml | 30 +++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_code_checks.yaml b/.github/workflows/run_code_checks.yaml index 0a27d9f..b3c5d1e 100644 --- a/.github/workflows/run_code_checks.yaml +++ b/.github/workflows/run_code_checks.yaml @@ -36,8 +36,32 @@ jobs: with: python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' + # Create a custom unit tests job, because apify-shared-python does not unit codecov report. unit_tests: name: Unit tests - uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main - with: - python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + + - name: Set up uv package manager + uses: astral-sh/setup-uv@v7 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Python dependencies + run: make install-dev + + - name: Run unit tests + run: make unit-tests-cov From abf9563ac84d8b9e37be55e4ca77d556200eb9c2 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Sun, 14 Dec 2025 18:22:28 +0100 Subject: [PATCH 3/7] Separate code_checks and doc_checks --- .github/workflows/{run_code_checks.yaml => code_checks.yaml} | 0 .github/workflows/pre_release.yaml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{run_code_checks.yaml => code_checks.yaml} (100%) diff --git a/.github/workflows/run_code_checks.yaml b/.github/workflows/code_checks.yaml similarity index 100% rename from .github/workflows/run_code_checks.yaml rename to .github/workflows/code_checks.yaml diff --git a/.github/workflows/pre_release.yaml b/.github/workflows/pre_release.yaml index 6cd4509..2bd3b09 100644 --- a/.github/workflows/pre_release.yaml +++ b/.github/workflows/pre_release.yaml @@ -34,7 +34,7 @@ jobs: run_code_checks: name: Run code checks - uses: ./.github/workflows/run_code_checks.yaml + uses: ./.github/workflows/code_checks.yaml update_changelog: name: Update changelog From c312481c547c432a619d56dd084d3eeac518626e Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Sun, 14 Dec 2025 18:25:50 +0100 Subject: [PATCH 4/7] fix code checks reference --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 91f04ad..64de769 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -41,7 +41,7 @@ jobs: run_code_checks: name: Run code checks - uses: ./.github/workflows/run_code_checks.yaml + uses: ./.github/workflows/code_checks.yaml update_changelog: name: Update changelog From 3b98ff7fc000684ae102e6de534c6ee16f95475a Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Mon, 15 Dec 2025 17:22:43 +0100 Subject: [PATCH 5/7] Update naming --- .github/workflows/_check_code.yaml | 30 +++++++++ .../{pre_release.yaml => _release_pre.yaml} | 33 ++++----- .github/workflows/_tests.yaml | 39 +++++++++++ .github/workflows/check_pr_title.yaml | 14 ---- .github/workflows/code_checks.yaml | 67 ------------------- ...elease.yaml => manual_release_stable.yaml} | 28 +++++--- .../{update_new_issue.yaml => on_issue.yaml} | 7 +- .github/workflows/on_master.yaml | 24 +++++++ .github/workflows/on_pull_request.yaml | 22 ++++++ 9 files changed, 156 insertions(+), 108 deletions(-) create mode 100644 .github/workflows/_check_code.yaml rename .github/workflows/{pre_release.yaml => _release_pre.yaml} (74%) create mode 100644 .github/workflows/_tests.yaml delete mode 100644 .github/workflows/check_pr_title.yaml delete mode 100644 .github/workflows/code_checks.yaml rename .github/workflows/{release.yaml => manual_release_stable.yaml} (84%) rename .github/workflows/{update_new_issue.yaml => on_issue.yaml} (79%) create mode 100644 .github/workflows/on_master.yaml create mode 100644 .github/workflows/on_pull_request.yaml diff --git a/.github/workflows/_check_code.yaml b/.github/workflows/_check_code.yaml new file mode 100644 index 0000000..765a6a8 --- /dev/null +++ b/.github/workflows/_check_code.yaml @@ -0,0 +1,30 @@ +name: Code checks + +on: + # Runs when manually triggered from the GitHub UI. + workflow_dispatch: + + # Runs when invoked by another workflow. + workflow_call: + +jobs: + actions_lint_check: + name: Actions lint check + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + - name: Run actionlint + uses: rhysd/actionlint@v1.7.9 + + lint_check: + name: Lint check + uses: apify/workflows/.github/workflows/python_lint_check.yaml@main + with: + python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' + + type_check: + name: Type check + uses: apify/workflows/.github/workflows/python_type_check.yaml@main + with: + python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' diff --git a/.github/workflows/pre_release.yaml b/.github/workflows/_release_pre.yaml similarity index 74% rename from .github/workflows/pre_release.yaml rename to .github/workflows/_release_pre.yaml index 2bd3b09..ec863e5 100644 --- a/.github/workflows/pre_release.yaml +++ b/.github/workflows/_release_pre.yaml @@ -1,16 +1,16 @@ -name: Create a pre-release +name: Pre-release on: - # Trigger a beta version release (pre-release) on push to the master branch. - push: - branches: - - master - tags-ignore: - - "**" # Ignore all tags to prevent duplicate builds when tags are pushed. - - # Or it can be triggered manually. + # Runs when manually triggered from the GitHub UI. workflow_dispatch: + # Runs when invoked by another workflow. + workflow_call: + outputs: + changelog_commitish: + description: The commit SHA after updating the changelog + value: ${{ jobs.update_changelog.outputs.changelog_commitish }} + concurrency: group: release cancel-in-progress: false @@ -24,21 +24,17 @@ jobs: version_number: ${{ steps.release_metadata.outputs.version_number }} tag_name: ${{ steps.release_metadata.outputs.tag_name }} changelog: ${{ steps.release_metadata.outputs.changelog }} - existing_changelog_path: CHANGELOG.md steps: - uses: apify/workflows/git-cliff-release@main id: release_metadata name: Prepare release metadata with: release_type: prerelease - - run_code_checks: - name: Run code checks - uses: ./.github/workflows/code_checks.yaml + existing_changelog_path: CHANGELOG.md update_changelog: name: Update changelog - needs: [release_metadata, run_code_checks] + needs: [release_metadata] uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main with: version_number: ${{ needs.release_metadata.outputs.version_number }} @@ -47,8 +43,9 @@ jobs: APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} publish_to_pypi: + if: "!startsWith(github.event.head_commit.message, 'ci') && !startsWith(github.event.head_commit.message, 'docs')" name: Publish to PyPI - needs: [release_metadata, run_code_checks, update_changelog] + needs: [release_metadata, update_changelog] runs-on: ubuntu-latest permissions: contents: write @@ -64,6 +61,10 @@ jobs: is_prerelease: "yes" version_number: ${{ needs.release_metadata.outputs.version_number }} ref: ${{ needs.update_changelog.outputs.changelog_commitish }} + # Publishes the package to PyPI using PyPA official GitHub action with OIDC authentication. - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 + + # TODO: add job for publish package to Conda + # https://github.com/apify/crawlee-python/issues/104 diff --git a/.github/workflows/_tests.yaml b/.github/workflows/_tests.yaml new file mode 100644 index 0000000..d2093ad --- /dev/null +++ b/.github/workflows/_tests.yaml @@ -0,0 +1,39 @@ +name: Tests + +on: + # Runs when manually triggered from the GitHub UI. + workflow_dispatch: + + # Runs when invoked by another workflow. + workflow_call: + +jobs: + # Create a custom unit tests job, because apify-shared-python doesn't use codecov report. + unit_tests: + name: Unit tests + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + + - name: Set up uv package manager + uses: astral-sh/setup-uv@v7 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Python dependencies + run: make install-dev + + - name: Run unit tests + run: make unit-tests-cov diff --git a/.github/workflows/check_pr_title.yaml b/.github/workflows/check_pr_title.yaml deleted file mode 100644 index 73298ca..0000000 --- a/.github/workflows/check_pr_title.yaml +++ /dev/null @@ -1,14 +0,0 @@ -name: Check PR title - -on: - pull_request_target: - types: [opened, edited, synchronize] - -jobs: - check_pr_title: - name: Check PR title - runs-on: ubuntu-latest - steps: - - uses: amannn/action-semantic-pull-request@v5.5.3 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/code_checks.yaml b/.github/workflows/code_checks.yaml deleted file mode 100644 index b3c5d1e..0000000 --- a/.github/workflows/code_checks.yaml +++ /dev/null @@ -1,67 +0,0 @@ -name: Run code checks - -on: - # Trigger code checks on opening a new pull request. - # Secrets are only made available to the integration tests job, with a manual approval - # step required for PRs from forks. This prevents their potential exposure. - pull_request: - - # Trigger for pushing to the master branch is handled by the pre-release workflow. - - # It should also be possible to trigger checks manually - workflow_dispatch: - - # Allow this workflow to be invoked as a reusable workflow from other workflows - workflow_call: - -jobs: - actions_lint_check: - name: Actions lint check - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - name: Run actionlint - uses: rhysd/actionlint@v1.7.9 - - lint_check: - name: Lint check - uses: apify/workflows/.github/workflows/python_lint_check.yaml@main - with: - python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' - - type_check: - name: Type check - uses: apify/workflows/.github/workflows/python_type_check.yaml@main - with: - python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' - - # Create a custom unit tests job, because apify-shared-python does not unit codecov report. - unit_tests: - name: Unit tests - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest] - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - - - name: Set up uv package manager - uses: astral-sh/setup-uv@v7 - with: - python-version: ${{ matrix.python-version }} - - - name: Install Python dependencies - run: make install-dev - - - name: Run unit tests - run: make unit-tests-cov diff --git a/.github/workflows/release.yaml b/.github/workflows/manual_release_stable.yaml similarity index 84% rename from .github/workflows/release.yaml rename to .github/workflows/manual_release_stable.yaml index 64de769..79f4cb6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/manual_release_stable.yaml @@ -1,7 +1,7 @@ -name: Create a release +name: Stable release on: - # Trigger a stable version release via GitHub's UI, with the ability to specify the type of release. + # Runs when manually triggered from the GitHub UI, with options to specify the type of release. workflow_dispatch: inputs: release_type: @@ -21,9 +21,22 @@ on: type: string default: "" +concurrency: + group: release + cancel-in-progress: false + jobs: + code_checks: + name: Code checks + uses: ./.github/workflows/_check_code.yaml + + tests: + name: Tests + uses: ./.github/workflows/_tests.yaml + release_metadata: name: Prepare release metadata + needs: [code_checks, tests] runs-on: ubuntu-latest outputs: version_number: ${{ steps.release_metadata.outputs.version_number }} @@ -39,13 +52,9 @@ jobs: custom_version: ${{ inputs.custom_version }} existing_changelog_path: CHANGELOG.md - run_code_checks: - name: Run code checks - uses: ./.github/workflows/code_checks.yaml - update_changelog: name: Update changelog - needs: [release_metadata, run_code_checks] + needs: [release_metadata] uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main with: version_number: ${{ needs.release_metadata.outputs.version_number }} @@ -54,7 +63,7 @@ jobs: APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} create_github_release: - name: Create github release + name: Create GitHub release needs: [release_metadata, update_changelog] runs-on: ubuntu-latest env: @@ -89,3 +98,6 @@ jobs: # Publishes the package to PyPI using PyPA official GitHub action with OIDC authentication. - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 + + # TODO: add job for publish package to Conda + # https://github.com/apify/crawlee-python/issues/104 diff --git a/.github/workflows/update_new_issue.yaml b/.github/workflows/on_issue.yaml similarity index 79% rename from .github/workflows/update_new_issue.yaml rename to .github/workflows/on_issue.yaml index 7946544..c758a37 100644 --- a/.github/workflows/update_new_issue.yaml +++ b/.github/workflows/on_issue.yaml @@ -1,20 +1,21 @@ -name: Update new issue +name: CI (issue) on: + # Runs when a new issue is opened. issues: types: - opened jobs: label_issues: - name: Label issues + name: Add labels runs-on: ubuntu-latest permissions: issues: write steps: # Add the "t-tooling" label to all new issues - - uses: actions/github-script@v7 + - uses: actions/github-script@v8 with: script: | github.rest.issues.addLabels({ diff --git a/.github/workflows/on_master.yaml b/.github/workflows/on_master.yaml new file mode 100644 index 0000000..071b7f2 --- /dev/null +++ b/.github/workflows/on_master.yaml @@ -0,0 +1,24 @@ +name: CI (master) + +on: + # Runs on every push to the master branch. + push: + branches: + - master + tags-ignore: + - "**" # Ignore all tags to avoid duplicate executions triggered by tag pushes. + +jobs: + code_checks: + name: Code checks + uses: ./.github/workflows/_check_code.yaml + + tests: + name: Tests + uses: ./.github/workflows/_tests.yaml + + pre_release: + name: Pre-release + needs: [code_checks, tests] + uses: ./.github/workflows/_release_pre.yaml + secrets: inherit diff --git a/.github/workflows/on_pull_request.yaml b/.github/workflows/on_pull_request.yaml new file mode 100644 index 0000000..0e2aaa9 --- /dev/null +++ b/.github/workflows/on_pull_request.yaml @@ -0,0 +1,22 @@ +name: CI (PR) + +on: + # Runs whenever a pull request is opened or updated. + pull_request: + +jobs: + check_pr_title: + name: Check PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v6.1.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + code_checks: + name: Code checks + uses: ./.github/workflows/_check_code.yaml + + tests: + name: Tests + uses: ./.github/workflows/_tests.yaml From 81ce8908a2542089ad6ba4a4c4f5ca7fee6002f7 Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Mon, 15 Dec 2025 17:43:17 +0100 Subject: [PATCH 6/7] rm todo to conda --- .github/workflows/_release_pre.yaml | 3 --- .github/workflows/manual_release_stable.yaml | 4 +--- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/_release_pre.yaml b/.github/workflows/_release_pre.yaml index ec863e5..e8542b0 100644 --- a/.github/workflows/_release_pre.yaml +++ b/.github/workflows/_release_pre.yaml @@ -65,6 +65,3 @@ jobs: # Publishes the package to PyPI using PyPA official GitHub action with OIDC authentication. - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - - # TODO: add job for publish package to Conda - # https://github.com/apify/crawlee-python/issues/104 diff --git a/.github/workflows/manual_release_stable.yaml b/.github/workflows/manual_release_stable.yaml index 79f4cb6..0d73f66 100644 --- a/.github/workflows/manual_release_stable.yaml +++ b/.github/workflows/manual_release_stable.yaml @@ -95,9 +95,7 @@ jobs: is_prerelease: "" version_number: ${{ needs.release_metadata.outputs.version_number }} ref: ${{ needs.update_changelog.outputs.changelog_commitish }} + # Publishes the package to PyPI using PyPA official GitHub action with OIDC authentication. - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - - # TODO: add job for publish package to Conda - # https://github.com/apify/crawlee-python/issues/104 From d638d03b59f49374f5763af913244ada9c9304db Mon Sep 17 00:00:00 2001 From: Vlada Dusek Date: Tue, 16 Dec 2025 19:16:15 +0100 Subject: [PATCH 7/7] Update --- .github/workflows/_release_pre.yaml | 67 -------------------- .github/workflows/manual_release_stable.yaml | 55 ++++++++-------- .github/workflows/on_master.yaml | 58 +++++++++++++++-- .github/workflows/on_pull_request.yaml | 4 +- 4 files changed, 82 insertions(+), 102 deletions(-) delete mode 100644 .github/workflows/_release_pre.yaml diff --git a/.github/workflows/_release_pre.yaml b/.github/workflows/_release_pre.yaml deleted file mode 100644 index e8542b0..0000000 --- a/.github/workflows/_release_pre.yaml +++ /dev/null @@ -1,67 +0,0 @@ -name: Pre-release - -on: - # Runs when manually triggered from the GitHub UI. - workflow_dispatch: - - # Runs when invoked by another workflow. - workflow_call: - outputs: - changelog_commitish: - description: The commit SHA after updating the changelog - value: ${{ jobs.update_changelog.outputs.changelog_commitish }} - -concurrency: - group: release - cancel-in-progress: false - -jobs: - release_metadata: - if: "!startsWith(github.event.head_commit.message, 'docs') && !startsWith(github.event.head_commit.message, 'ci') && startsWith(github.repository, 'apify/')" - name: Prepare release metadata - runs-on: ubuntu-latest - outputs: - version_number: ${{ steps.release_metadata.outputs.version_number }} - tag_name: ${{ steps.release_metadata.outputs.tag_name }} - changelog: ${{ steps.release_metadata.outputs.changelog }} - steps: - - uses: apify/workflows/git-cliff-release@main - id: release_metadata - name: Prepare release metadata - with: - release_type: prerelease - existing_changelog_path: CHANGELOG.md - - update_changelog: - name: Update changelog - needs: [release_metadata] - uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main - with: - version_number: ${{ needs.release_metadata.outputs.version_number }} - changelog: ${{ needs.release_metadata.outputs.changelog }} - secrets: - APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} - - publish_to_pypi: - if: "!startsWith(github.event.head_commit.message, 'ci') && !startsWith(github.event.head_commit.message, 'docs')" - name: Publish to PyPI - needs: [release_metadata, update_changelog] - runs-on: ubuntu-latest - permissions: - contents: write - id-token: write # Required for OIDC authentication. - environment: - name: pypi - url: https://pypi.org/project/apify-shared - steps: - - name: Prepare distribution - uses: apify/workflows/prepare-pypi-distribution@main - with: - package_name: apify-shared - is_prerelease: "yes" - version_number: ${{ needs.release_metadata.outputs.version_number }} - ref: ${{ needs.update_changelog.outputs.changelog_commitish }} - - # Publishes the package to PyPI using PyPA official GitHub action with OIDC authentication. - - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/manual_release_stable.yaml b/.github/workflows/manual_release_stable.yaml index 0d73f66..f5ff240 100644 --- a/.github/workflows/manual_release_stable.yaml +++ b/.github/workflows/manual_release_stable.yaml @@ -34,52 +34,51 @@ jobs: name: Tests uses: ./.github/workflows/_tests.yaml - release_metadata: - name: Prepare release metadata + release_prepare: + name: Release prepare needs: [code_checks, tests] runs-on: ubuntu-latest outputs: - version_number: ${{ steps.release_metadata.outputs.version_number }} - tag_name: ${{ steps.release_metadata.outputs.tag_name }} - changelog: ${{ steps.release_metadata.outputs.changelog }} - release_notes: ${{ steps.release_metadata.outputs.release_notes }} + version_number: ${{ steps.release_prepare.outputs.version_number }} + tag_name: ${{ steps.release_prepare.outputs.tag_name }} + changelog: ${{ steps.release_prepare.outputs.changelog }} + release_notes: ${{ steps.release_prepare.outputs.release_notes }} steps: - uses: apify/workflows/git-cliff-release@main - name: Prepare release metadata - id: release_metadata + name: Release prepare + id: release_prepare with: release_type: ${{ inputs.release_type }} custom_version: ${{ inputs.custom_version }} existing_changelog_path: CHANGELOG.md - update_changelog: - name: Update changelog - needs: [release_metadata] + changelog_update: + name: Changelog update + needs: [release_prepare] uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main with: - version_number: ${{ needs.release_metadata.outputs.version_number }} - changelog: ${{ needs.release_metadata.outputs.changelog }} - secrets: - APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} + version_number: ${{ needs.release_prepare.outputs.version_number }} + changelog: ${{ needs.release_prepare.outputs.changelog }} + secrets: inherit - create_github_release: - name: Create GitHub release - needs: [release_metadata, update_changelog] + github_release: + name: GitHub release + needs: [release_prepare, changelog_update] runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - name: Create release + - name: GitHub release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ needs.release_metadata.outputs.tag_name }} - name: ${{ needs.release_metadata.outputs.version_number }} - target_commitish: ${{ needs.update_changelog.outputs.changelog_commitish }} - body: ${{ needs.release_metadata.outputs.release_notes }} + tag_name: ${{ needs.release_prepare.outputs.tag_name }} + name: ${{ needs.release_prepare.outputs.version_number }} + target_commitish: ${{ needs.changelog_update.outputs.changelog_commitish }} + body: ${{ needs.release_prepare.outputs.release_notes }} - publish_to_pypi: - name: Publish to PyPI - needs: [release_metadata, update_changelog] + pypi_publish: + name: PyPI publish + needs: [release_prepare, changelog_update] runs-on: ubuntu-latest permissions: contents: write @@ -93,8 +92,8 @@ jobs: with: package_name: apify-shared is_prerelease: "" - version_number: ${{ needs.release_metadata.outputs.version_number }} - ref: ${{ needs.update_changelog.outputs.changelog_commitish }} + version_number: ${{ needs.release_prepare.outputs.version_number }} + ref: ${{ needs.changelog_update.outputs.changelog_commitish }} # Publishes the package to PyPI using PyPA official GitHub action with OIDC authentication. - name: Publish package to PyPI diff --git a/.github/workflows/on_master.yaml b/.github/workflows/on_master.yaml index 071b7f2..1e87599 100644 --- a/.github/workflows/on_master.yaml +++ b/.github/workflows/on_master.yaml @@ -1,12 +1,15 @@ name: CI (master) on: - # Runs on every push to the master branch. push: branches: - master tags-ignore: - - "**" # Ignore all tags to avoid duplicate executions triggered by tag pushes. + - "**" # Ignore all tags to avoid duplicate executions triggered by tag pushes. + +concurrency: + group: release + cancel-in-progress: false jobs: code_checks: @@ -14,11 +17,56 @@ jobs: uses: ./.github/workflows/_check_code.yaml tests: + # Skip this for "ci" and "docs" commits. + if: "!startsWith(github.event.head_commit.message, 'ci') && !startsWith(github.event.head_commit.message, 'docs')" name: Tests uses: ./.github/workflows/_tests.yaml - pre_release: - name: Pre-release + release_prepare: + # Skip this for "ci", "docs" and "test" commits and for forks. + 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/')" + name: Release prepare needs: [code_checks, tests] - uses: ./.github/workflows/_release_pre.yaml + runs-on: ubuntu-latest + outputs: + version_number: ${{ steps.release_prepare.outputs.version_number }} + tag_name: ${{ steps.release_prepare.outputs.tag_name }} + changelog: ${{ steps.release_prepare.outputs.changelog }} + steps: + - uses: apify/workflows/git-cliff-release@main + id: release_prepare + name: Release prepare + with: + release_type: prerelease + existing_changelog_path: CHANGELOG.md + + changelog_update: + name: Changelog update + needs: [release_prepare] + uses: apify/workflows/.github/workflows/python_bump_and_update_changelog.yaml@main + with: + version_number: ${{ needs.release_prepare.outputs.version_number }} + changelog: ${{ needs.release_prepare.outputs.changelog }} secrets: inherit + + pypi_publish: + name: PyPI publish + needs: [release_prepare, changelog_update] + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write # Required for OIDC authentication. + environment: + name: pypi + url: https://pypi.org/project/apify-shared + steps: + - name: Prepare distribution + uses: apify/workflows/prepare-pypi-distribution@main + with: + package_name: apify-shared + is_prerelease: "yes" + version_number: ${{ needs.release_prepare.outputs.version_number }} + ref: ${{ needs.changelog_update.outputs.changelog_commitish }} + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/on_pull_request.yaml b/.github/workflows/on_pull_request.yaml index 0e2aaa9..13b0e97 100644 --- a/.github/workflows/on_pull_request.yaml +++ b/.github/workflows/on_pull_request.yaml @@ -5,8 +5,8 @@ on: pull_request: jobs: - check_pr_title: - name: Check PR title + pr_title_check: + name: PR title check runs-on: ubuntu-latest steps: - uses: amannn/action-semantic-pull-request@v6.1.1