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
29 changes: 29 additions & 0 deletions .github/workflows/_changelog_entry_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Changelog entry check

on:
workflow_call:

jobs:
check_changelog_entry:
name: Changelog entry check
runs-on: ubuntu-latest
if: (!startsWith(github.event.pull_request.title, 'docs:'))
env:
PYTHON_VERSION: 3.12

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 dependencies
run: |
pipx install --python ${{ env.PYTHON_VERSION }} poetry
make install-dev

- name: Execute changelog entry check
run: make check-changelog-entry
87 changes: 87 additions & 0 deletions .github/workflows/_publish_to_pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Publish to PyPI

on:
workflow_call:
inputs:
version_number:
required: true
type: string

jobs:
publish_to_pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # Required for OIDC authentication.
environment:
name: pypi
url: https://pypi.org/project/crawlee
env:
PYTHON_VERSION: 3.12

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 dependencies
run: |
pipx install --python ${{ env.PYTHON_VERSION }} poetry
make install-dev

# Determines the release type based on the event that triggered the workflow.
- name: Determine release type
id: determine-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
echo "release_type=${release_type}" >> $GITHUB_OUTPUT

# Updates the version number for pre-releases in the project's configuration.
- name: Set pre-release version
if: steps.determine-release-type.outputs.release_type != 'final'
run: python ./scripts/update_version_for_prerelease.py ${{ steps.determine-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

# If this workflow is not triggered by a GitHub release event, manually create and push a Git tag.
- name: Create Git tag with the published version
if: github.event_name != 'release'
run: |
GIT_TAG=v$(python ./scripts/print_current_package_version.py)
echo "Current package version retrieved: ${GIT_TAG}"

echo "Creating Git tag: ${GIT_TAG}"
git tag "$GIT_TAG"
echo "Git tag ${GIT_TAG} created successfully."

echo "Pushing Git tag ${GIT_TAG} to the remote repository."
git push origin tag "$GIT_TAG"
echo "Git tag ${GIT_TAG} pushed successfully."

# If triggered by a release, upload build artifacts to the associated GitHub release.
- name: Upload the build artifacts to release
if: github.event_name == 'release'
run: |
echo "Uploading build artifacts to GitHub release: ${{ github.ref_name }}"
gh release upload ${{ github.ref_name }} dist/*
echo "Build artifacts uploaded successfully."

env:
GH_TOKEN: ${{ github.token }}
29 changes: 29 additions & 0 deletions .github/workflows/_version_conflict_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Version conflict check

on:
workflow_call:

jobs:
check_version_conflict:
name: Version conflict check
runs-on: ubuntu-latest
if: (!startsWith(github.event.pull_request.title, 'docs:'))
env:
PYTHON_VERSION: 3.12

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 dependencies
run: |
pipx install --python ${{ env.PYTHON_VERSION }} poetry
make install-dev

- name: Execute version conflict check
run: make check-version-conflict
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,24 @@ jobs:
pages: write
id-token: write
runs-on: ubuntu-latest
env:
NODE_VERSION: 20
PYTHON_VERSION: 3.12

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}

- name: Set up Node.js
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: website/package-lock.json

- name: Install Node.js dependencies
- name: Install Node dependencies
run: |
npm install
npm update @apify/docs-theme
Expand All @@ -48,11 +51,11 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
- name: Install Python dependencies
run: |
pipx install poetry
pipx install --python ${{ matrix.python-version }} poetry
make install-dev

- name: Build generated API reference
Expand Down
31 changes: 0 additions & 31 deletions .github/workflows/check_version_availability.yaml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/integration_tests.yaml

This file was deleted.

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

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/run_checks.yaml

This file was deleted.

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

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

# Do not trigger code checks on push to the master branch, as they will be triggered
# by the release workflow.

# Trigger code checks on workflow call (e.g. from run release workflow).
workflow_call:

jobs:
lint_check:
name: Lint check
uses: apify/workflows/.github/workflows/python/lint_check.yaml

type_check:
name: Type check
uses: apify/workflows/.github/workflows/python/type_check.yaml

unit_tests:
name: Unit tests
uses: apify/workflows/.github/workflows/python/unit_tests.yaml

# TODO: remove this once https://github.com/apify/apify-sdk-python/issues/241 is resolved
changelog_entry_check:
name: Changelog entry check
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
uses: ./.github/workflows/_version_conflict_check.yaml

docs_check:
name: Docs check
uses: apify/workflows/.github/workflows/python/docs_check.yaml

integration_tests:
name: Integration tests
uses: apify/workflows/.github/workflows/python/integration_tests.yaml
secrets: inherit
Loading
Loading