Repository navigation
78 lines (77 loc) · 3.15 KB
/
Copy pathci.yml
File metadata and controls
78 lines (77 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: ci
on:
push:
branches:
- master
- main
concurrency:
group: "pages"
cancel-in-progress: false
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: 3.x
- uses: actions/cache@v6
with:
key: ${{ github.ref }}
path: .cache
- run: pip install -r requirements.txt
- run: sudo apt update && sudo apt-get install imagemagick pngquant libimage-exiftool-perl
# Shrink PNGs wider than 750 px for the published site (the repo keeps the
# originals). "750x>" must stay quoted: unquoted, the shell reads > as a
# redirect and mogrify never gets a file.
- run: find . -name '*.png' -execdir bash -c 'mogrify -resize "750x>" "$1"' - {} \;
- run: find . -name '*.png' -execdir bash -c 'pngquant "$1" --ext .png --force' - {} \;
# Nothing is published unless every check below passes. These are the
# pull request checks (tools/docs-checks/), run again right before
# publishing, so a package update since the PR (like selectolax 1.0.1,
# which dropped every image) can't publish a broken site. The checks all
# run even if one fails, so the log shows every problem. A failure stops
# the publish step, and Notify on Failure posts to Discord.
- name: Markdown (front matter, headings, alt text, includes)
run: python tools/docs-checks/check_markdown.py docs
- name: No secrets in text
if: ${{ !cancelled() }}
run: python tools/docs-checks/check_secrets.py docs
- name: Photos (GPS location data)
if: ${{ !cancelled() }}
env:
CHANGED_FILES: ""
run: python tools/docs-checks/check_images.py docs/assets
- name: Build the site
if: ${{ !cancelled() }}
env:
DISABLE_MKDOCS_2_WARNING: "true"
run: mkdocs build -d site
- name: Links, images, stylesheets, menus, and redirects in the built site
if: ${{ !cancelled() }}
run: python tools/docs-checks/check_links.py site docs
- name: Custom domain file (CNAME) is in the build
if: ${{ !cancelled() }}
run: test -s docs/CNAME && cmp docs/CNAME site/CNAME
# Same as `mkdocs gh-deploy --force`, but publishes the build checked
# above instead of building again. Runs only if every step passed.
- name: Publish the checked site to GitHub Pages
run: |
message="Deployed $(git rev-parse --short HEAD) with MkDocs version: $(python -c 'import mkdocs; print(mkdocs.__version__)')"
ghp-import --no-jekyll --push --force --message "$message" site
notify:
name: Notify on Failure
needs: [ deploy ]
if: failure()
runs-on: ubuntu-latest
steps:
- name: Send Discord notification
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ needs.deploy.result }}
title: Build Failed - Docs
description: Docs deploy job failed. Check the logs for details.
content: "Hey <@&1355984268496605356>"