Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/check_pr_title.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 0 additions & 24 deletions .github/workflows/check_version_availability.yaml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/lint_and_type_checks.yaml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/pre_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Create a 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.
workflow_dispatch:

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 }}
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/run_code_checks.yaml

update_changelog:
name: Update changelog
needs: [release_metadata, run_code_checks]
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:
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
163 changes: 69 additions & 94 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,116 +1,91 @@
name: Check & Release
name: Create a release

on:
# Push to master will publish a beta version
push:
branches:
- master
tags-ignore:
- "**"
# A release via GitHub releases will publish a stable version
release:
types: [published]
# Workflow dispatch will publish whatever you choose
# Trigger a stable version release via GitHub's UI, with the ability to specify the type of release.
workflow_dispatch:
inputs:
release_type:
description: Release type
required: true
type: choice
default: alpha
default: auto
options:
- alpha
- beta
- final
- auto
- custom
- patch
- minor
- major
custom_version:
description: The custom version to bump to (only for "custom" type)
required: false
type: string
default: ""

jobs:
lint_and_type_checks:
name: Run lint and type_checks
uses: ./.github/workflows/lint_and_type_checks.yaml

unit_tests:
name: Run unit tests
uses: ./.github/workflows/unit_tests.yaml
release_metadata:
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 }}
release_notes: ${{ steps.release_metadata.outputs.release_notes }}
steps:
- uses: apify/workflows/git-cliff-release@main
name: Prepare release metadata
id: release_metadata
with:
release_type: ${{ inputs.release_type }}
custom_version: ${{ inputs.custom_version }}
existing_changelog_path: CHANGELOG.md

run_code_checks:
name: Run code checks
uses: ./.github/workflows/run_code_checks.yaml

update_changelog:
name: Update changelog
needs: [release_metadata, run_code_checks]
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 }}

create_github_release:
name: Create github release
needs: [release_metadata, update_changelog]
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Create 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 }}

publish_to_pypi:
name: Publish to PyPI
needs: [lint_and_type_checks, unit_tests]
needs: [release_metadata, update_changelog]
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
id-token: write # Required for OIDC authentication.
environment:
name: pypi
url: https://pypi.org/p/apify-shared

url: https://pypi.org/project/apify-shared
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
- name: Prepare distribution
uses: apify/workflows/prepare-pypi-distribution@main
with:
python-version: 3.8

- name: Install dependencies
run: make install-dev

- # Determine if this is a prerelease or latest release
name: Determine release type
id: get-release-type
run: |
if [ ${{ github.event_name }} = release ]; then
release_type="final"
elif [ ${{ github.event_name }} = push ]; then
release_type="beta"
elif [ ${{ github.event_name }} = workflow_dispatch ]; then
release_type=${{ github.event.inputs.release_type }}
fi

if [ ${release_type} = final ]; then
docker_image_tag="latest"
elif [ ${release_type} = beta ]; then
docker_image_tag="beta"
else
docker_image_tag=""
fi

echo "release_type=${release_type}" >> $GITHUB_OUTPUT
echo "docker_image_tag=${docker_image_tag}" >> $GITHUB_OUTPUT

- # Check whether the released version is listed in CHANGELOG.md
name: Check whether the released version is listed in the changelog
if: steps.get-release-type.outputs.release_type != 'alpha'
run: make check-changelog-entry

- # Check version consistency and increment pre-release version number for prereleases (must be the last step before build)
name: Bump pre-release version
if: steps.get-release-type.outputs.release_type != 'final'
run: python ./scripts/update_version_for_prerelease.py ${{ steps.get-release-type.outputs.release_type }}

- # Build a source distribution and a python3-only wheel
name: Build distribution files
run: make build

- # Check whether the package description will render correctly on PyPI
name: Check package rendering on PyPI
run: make twine-check

- # Publish package to PyPI using their official GitHub action
name: Publish package to PyPI
package_name: apify-shared
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

- # Tag the current commit with the version tag if this is not made from the release event (releases are tagged with the release process)
name: Tag Version
if: github.event_name != 'release'
run: |
git_tag=v`python ./scripts/print_current_package_version.py`
git tag $git_tag
git push origin $git_tag

- # Upload the build artifacts to the release
name: Upload the build artifacts to release
if: github.event_name == 'release'
run: gh release upload ${{ github.ref_name }} dist/*
env:
GH_TOKEN: ${{ github.token }}
18 changes: 0 additions & 18 deletions .github/workflows/run_checks.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/run_code_checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Run code checks

on:
# Trigger code checks on opening a new pull request.
pull_request:

jobs:
lint_check:
name: Lint check
uses: apify/workflows/.github/workflows/python_lint_check.yaml@main

type_check:
name: Type check
uses: apify/workflows/.github/workflows/python_type_check.yaml@main

unit_tests:
name: Unit tests
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main
28 changes: 0 additions & 28 deletions .github/workflows/unit_tests.yaml

This file was deleted.

Loading
Loading