Skip to content

feat: add crawlee version to system info print (#304) #20

feat: add crawlee version to system info print (#304)

feat: add crawlee version to system info print (#304) #20

Workflow file for this run

name: Run 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.
workflow_dispatch:
inputs:
release_type:
description: Release type
required: true
type: choice
default: alpha
options:
- alpha
- beta
- final
env:
PYTHON_VERSION: 3.12
jobs:
should_release:
name: Check whether to release
if: (!startsWith(github.event.head_commit.message, 'docs:') || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
steps:
- name: Dummy step
run: "true"
lint_check:
name: Lint check
needs: [should_release]
uses: apify/workflows/.github/workflows/python_lint_check.yaml@main
type_check:
name: Type check
needs: [should_release]
uses: apify/workflows/.github/workflows/python_type_check.yaml@main
unit_tests:
name: Unit tests
needs: [should_release]
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main
# TODO: remove this once https://github.com/apify/apify-sdk-python/issues/241 is resolved
changelog_entry_check:
name: Changelog entry check
needs: [should_release]
uses: ./.github/workflows/_changelog_entry_check.yaml
# TODO: remove this once https://github.com/apify/apify-sdk-python/issues/241 is resolved
version_conflict_check:
name: Version conflict check
needs: [should_release]
uses: ./.github/workflows/_version_conflict_check.yaml
integration_tests:
name: Integration tests
needs: [should_release]
uses: apify/workflows/.github/workflows/python_integration_tests.yaml@main
secrets: inherit
publish_to_pypi:
name: Publish to PyPI
needs:
[
should_release,
lint_check,
type_check,
unit_tests,
changelog_entry_check,
version_conflict_check,
integration_tests,
]
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
environment:
name: pypi
url: https://pypi.org/project/apify/
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Python dependencies
run: |
pipx install --python ${{ env.PYTHON_VERSION }} poetry
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 }}
# Builds the package.
- name: Build package
run: make build
# 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 }}
- # Trigger building the Python Docker images in apify/apify-actor-docker repo
name: Trigger Docker image build
run: |
PACKAGE_VERSION=`python ./scripts/print_current_package_version.py`
gh api -X POST "/repos/apify/apify-actor-docker/dispatches" \
-F event_type=build-python-images \
-F client_payload[release_tag]=${{ steps.get-release-type.outputs.docker_image_tag }} \
-F client_payload[apify_version]=$PACKAGE_VERSION
env:
GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}