Skip to content

Commit 69ffb9f

Browse files
committed
ci: migrate docs ci to zensical
1 parent dd7ef95 commit 69ffb9f

3 files changed

Lines changed: 50 additions & 33 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ on: # yamllint disable-line rule:truthy
1212
types:
1313
- published
1414

15+
permissions: read-all
16+
1517
jobs:
1618
lint:
1719
runs-on: ubuntu-latest
@@ -71,16 +73,18 @@ jobs:
7173
enable-cache: true
7274

7375
- name: Set up Python ${{ matrix.python-version }}
74-
run: uv python install ${{ matrix.python-version }}
76+
run: uv python install "$PY_VERSION"
77+
env:
78+
PY_VERSION: ${{ matrix.python-version }}
7579

7680
- name: Install dependencies
7781
run: uv sync --all-extras
7882

7983
- name: Test with tox
80-
run: |
81-
PY_VERSION=${{ matrix.python-version }} &&
82-
uv run tox -e py${PY_VERSION//.}-${{ matrix.dj-version }}
84+
run: uv run tox -e "py${PY_VERSION//.}-${DJ_VERSION}"
8385
env:
86+
PY_VERSION: ${{ matrix.python-version }}
87+
DJ_VERSION: ${{ matrix.dj-version }}
8488
REDIS_URL: redis://localhost:6379/0
8589

8690
- name: Upload coverage to Codecov

.github/workflows/docs.yml

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ on:
88
types:
99
- published
1010

11-
permissions:
12-
contents: write
11+
permissions: read-all
1312

1413
jobs:
1514
deploy:
1615
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
1718
steps:
1819
- uses: actions/checkout@v4
19-
with:
20-
fetch-depth: 0
2120

2221
- name: Install uv
2322
uses: astral-sh/setup-uv@v5
@@ -30,21 +29,31 @@ jobs:
3029
- name: Install docs dependencies
3130
run: uv sync --extra docs
3231

33-
- name: Configure git
34-
run: |
35-
git config user.name "github-actions[bot]"
36-
git config user.email "github-actions[bot]@users.noreply.github.com"
37-
38-
- name: Fetch gh-pages branch
39-
run: git fetch origin gh-pages --depth=1 || true
32+
- name: Build docs
33+
run: uv run zensical build
4034

4135
- name: Deploy dev docs (on push to main)
4236
if: github.event_name == 'push'
43-
run: uv run mike deploy --push dev
37+
uses: peaceiris/actions-gh-pages@v4
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
publish_dir: ./site
41+
destination_dir: dev
42+
keep_files: true
4443

4544
- name: Deploy versioned docs (on release)
4645
if: github.event_name == 'release'
47-
run: |
48-
VERSION="${{ github.event.release.tag_name }}"
49-
uv run mike deploy --push --update-aliases "$VERSION" latest
50-
uv run mike set-default --push latest
46+
uses: peaceiris/actions-gh-pages@v4
47+
with:
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
publish_dir: ./site
50+
destination_dir: ${{ github.event.release.tag_name }}
51+
keep_files: true
52+
53+
- name: Update root (latest) on release
54+
if: github.event_name == 'release'
55+
uses: peaceiris/actions-gh-pages@v4
56+
with:
57+
github_token: ${{ secrets.GITHUB_TOKEN }}
58+
publish_dir: ./site
59+
keep_files: true

.github/workflows/release-drafter.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,19 @@ on:
66
push:
77
branches:
88
- main
9-
pull_request:
10-
branches:
11-
- main
12-
types:
13-
- opened
14-
- reopened
15-
- synchronize
16-
- edited
179
pull_request_target:
18-
types: [opened, reopened, synchronize]
10+
types: [opened, reopened, synchronize, edited]
1911

20-
permissions:
21-
contents: write # for release-drafter/release-drafter to create a github release
22-
pull-requests: write # for release-drafter/release-drafter to add label to PR
12+
permissions: read-all
2313

2414
jobs:
2515
update_pr_labels:
2616
name: Update PR Labels
27-
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
17+
if: github.event_name == 'pull_request_target'
2818
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read # for release-drafter to read config/repo metadata
21+
pull-requests: write # for release-drafter to add labels to PR
2922
steps:
3023
- uses: release-drafter/release-drafter@v6
3124
with:
@@ -38,10 +31,21 @@ jobs:
3831
name: Update Release Draft
3932
if: github.event_name == 'push'
4033
runs-on: ubuntu-latest
34+
permissions:
35+
contents: write # for release-drafter to create/update release draft
36+
env:
37+
PUBLISH_DRAFT: false
4138
steps:
39+
- name: Check if a version is cut
40+
if: "contains(github.event.head_commit.message, 'chore(prerelease): Cut Version')"
41+
run: |
42+
echo "PUBLISH_DRAFT=true" >> $GITHUB_ENV
43+
44+
# Drafts your next Release notes
4245
- uses: release-drafter/release-drafter@v6
4346
with:
4447
disable-autolabeler: true
4548
disable-releaser: false
49+
publish: ${{ env.PUBLISH_DRAFT }}
4650
env:
4751
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)