Skip to content

Commit 040778b

Browse files
ci: Split docs deployment into a separate workflow
1 parent ed4c3e5 commit 040778b

File tree

2 files changed

+39
-25
lines changed

2 files changed

+39
-25
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: build
33
on:
44
push:
55
pull_request:
6+
workflow_call:
67

78
jobs:
89
build:
@@ -19,15 +20,13 @@ jobs:
1920
runs-on: ${{ matrix.os }}
2021

2122
steps:
22-
- name: Check out repository
23-
uses: actions/checkout@v4
24-
25-
- name: Set up Python
23+
- uses: actions/checkout@v4
24+
- name: Set up Python ${{ matrix.version }}
2625
uses: actions/setup-python@v5
2726
with:
2827
python-version: ${{ matrix.version }}
2928

30-
- name: Install package
29+
- name: Install packages
3130
run: pip install .
3231

3332
- name: Run tests
@@ -44,7 +43,6 @@ jobs:
4443
uses: actions/upload-pages-artifact@v3
4544
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.12'
4645
with:
47-
name: docs
4846
path: html/
4947

5048
- name: Install pypa/build
@@ -60,25 +58,6 @@ jobs:
6058
name: python-package-distributions
6159
path: dist/
6260

63-
deploy-docs:
64-
name: Deploy Docs to GitHub Pages
65-
if: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' }}
66-
runs-on: ubuntu-latest
67-
needs: [build]
68-
permissions:
69-
pages: write # to deploy to Pages
70-
id-token: write # to verify the deployment originates from an appropriate source
71-
environment:
72-
name: github-pages
73-
url: ${{ steps.deployment.outputs.page_url }}
74-
75-
steps:
76-
- name: Deploy to GitHub Pages
77-
id: deployment
78-
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
79-
with:
80-
artifact_name: docs
81-
8261
deploy-testpypi:
8362
name: Deploy Distribution to Test PyPI
8463
if: false # Currently disabled
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Deploy docs to Github Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags:
7+
- 'v*'
8+
9+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
10+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
11+
concurrency:
12+
group: "pages"
13+
cancel-in-progress: false
14+
15+
jobs:
16+
build:
17+
if: github.ref_protected == true
18+
uses: ./.github/workflows/build.yml
19+
20+
deploy-docs:
21+
name: Deploy Docs to GitHub Pages
22+
if: github.ref_protected == true
23+
runs-on: ubuntu-latest
24+
needs: [build]
25+
permissions:
26+
pages: write # to deploy to Pages
27+
id-token: write # to verify the deployment originates from an appropriate source
28+
environment:
29+
name: github-pages
30+
url: ${{ steps.deployment.outputs.page_url }}
31+
32+
steps:
33+
- name: Deploy to GitHub Pages
34+
id: deployment
35+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)