-
Notifications
You must be signed in to change notification settings - Fork 199
106 lines (100 loc) · 2.85 KB
/
main.yml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: CI
on:
push:
branches:
- master
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
pa11y-ci:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Setup Chrome
uses: browser-actions/setup-chrome@v1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
check-latest: true
- run: npm install -g pa11y-ci
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: github-pages
- run: |
mkdir _site
tar -xf artifact.tar -C _site/
- name: Run pa11y-ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
url="$(gh api "repos/$GITHUB_REPOSITORY/pages" --jq '.html_url')"
(bundle exec jekyll serve -d _tmp_site --no-watch & echo $! >&3) 3>_jekyll.pid | grep -q 'Server running'
pa11y-ci --sitemap 'http://localhost:4000/whiteglass/sitemap.xml' \
--sitemap-find "$url" --sitemap-replace 'http://localhost:4000/whiteglass/'
kill -9 "$(cat _jekyll.pid)"
rm -f _jekyll.pid
rm -rf _tmp_site
validate:
needs: build
runs-on: ubuntu-latest
steps:
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install -U html5validator
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: github-pages
- run: |
mkdir _site
tar -xf artifact.tar -C _site/
- run: html5validator --Werror --also-check-css --also-check-svg --root _site/
deploy:
needs: [build, pa11y-ci, validate]
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4