Skip to content

Commit 66c49d0

Browse files
authored
ci: use shared workflows and refactor them (#593)
1 parent 2a1cbb5 commit 66c49d0

File tree

10 files changed

+121
-241
lines changed

10 files changed

+121
-241
lines changed

.github/workflows/_check_docs_build.yaml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/_linting.yaml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/_publish_to_pypi.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
required: true
88
type: string
99

10+
env:
11+
PYTHON_VERSION: 3.12
12+
1013
jobs:
1114
publish_to_pypi:
1215
name: Publish to PyPI
@@ -17,8 +20,6 @@ jobs:
1720
environment:
1821
name: pypi
1922
url: https://pypi.org/project/crawlee
20-
env:
21-
PYTHON_VERSION: 3.12
2223

2324
steps:
2425
- name: Checkout repository

.github/workflows/_type_checking.yaml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/_unit_tests.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Build and deploy docs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
env:
10+
NODE_VERSION: 20
11+
PYTHON_VERSION: 3.12
12+
13+
jobs:
14+
build_and_deploy_docs:
15+
environment:
16+
name: github-pages
17+
permissions:
18+
contents: write
19+
pages: write
20+
id-token: write
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
28+
29+
- name: Set up Node
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: ${{ env.NODE_VERSION }}
33+
cache: npm
34+
cache-dependency-path: website/package-lock.json
35+
36+
- name: Install Node dependencies
37+
run: |
38+
npm install
39+
npm update @apify/docs-theme
40+
working-directory: ./website
41+
42+
# We do this as early as possible to prevent conflicts if someone else would push something in the meantime
43+
- name: Commit the updated package.json and lockfile
44+
run: |
45+
git config user.name 'GitHub Actions'
46+
git config user.email 'github-actions[bot]@users.noreply.github.com'
47+
git add website/package.json
48+
git add website/package-lock.json
49+
git diff-index --quiet HEAD || git commit -m 'chore: Automatic docs theme update [skip ci]' || true
50+
git push
51+
52+
- name: Set up Python
53+
uses: actions/setup-python@v5
54+
with:
55+
python-version: ${{ env.PYTHON_VERSION }}
56+
57+
- name: Install Python dependencies
58+
run: |
59+
pipx install --python ${{ env.PYTHON_VERSION }} poetry
60+
make install-dev
61+
62+
- name: Build generated API reference
63+
run: make build-api-reference
64+
65+
- name: Build Docusaurus docs
66+
run: make build-docs
67+
68+
- name: Set up GitHub Pages
69+
uses: actions/configure-pages@v5
70+
71+
- name: Upload GitHub Pages artifact
72+
uses: actions/upload-pages-artifact@v3
73+
with:
74+
path: ./website/build
75+
76+
- name: Deploy artifact to GitHub Pages
77+
uses: actions/deploy-pages@v4
78+
79+
- name: Invalidate CloudFront cache
80+
run: gh workflow run invalidate.yaml --repo apify/apify-docs-private
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}

.github/workflows/docs.yaml

Lines changed: 0 additions & 68 deletions
This file was deleted.

.github/workflows/run_code_checks.yaml

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,23 @@ name: Run code checks
22

33
on:
44
# Trigger code checks on opening a new pull request.
5-
pull_request_target:
6-
7-
# Do not trigger code checks on push to the master branch, as they will be triggered
8-
# by the release workflow.
9-
10-
# Trigger code checks on workflow call (e.g. from run release workflow).
11-
workflow_call:
5+
# Secrets are only made available to the integration tests job, with a manual approval
6+
# step required for PRs from forks. This prevents their potential exposure.
7+
pull_request:
128

139
jobs:
14-
run_linting:
15-
name: Run linting
16-
uses: ./.github/workflows/_linting.yaml
10+
lint_check:
11+
name: Lint check
12+
uses: apify/workflows/.github/workflows/python_lint_check.yaml@main
1713

18-
run_type_checking:
19-
name: Run type checking
20-
uses: ./.github/workflows/_type_checking.yaml
14+
type_check:
15+
name: Type check
16+
uses: apify/workflows/.github/workflows/python_type_check.yaml@main
2117

22-
run_unit_tests:
23-
name: Run unit tests
24-
uses: ./.github/workflows/_unit_tests.yaml
18+
unit_tests:
19+
name: Unit tests
20+
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main
2521

26-
check_docs_build:
27-
name: Check docs build
28-
uses: ./.github/workflows/_check_docs_build.yaml
22+
docs_check:
23+
name: Docs check
24+
uses: apify/workflows/.github/workflows/python_docs_check.yaml@main

0 commit comments

Comments
 (0)