-
Notifications
You must be signed in to change notification settings - Fork 199
109 lines (103 loc) · 2.91 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
107
108
109
name: CI
on:
push:
branches:
- master
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
jekyll: ["< 4.0", "< 5.0"]
env:
JEKYLL_VERSION: ${{ matrix.jekyll }}
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
if: ${{ matrix.jekyll == '< 5.0' }}
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
- name: Extract artifact
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: Download artifact
uses: actions/download-artifact@v4
with:
name: github-pages
- name: Extract artifact
run: |
mkdir _site
tar -xf artifact.tar -C _site/
- name: HTML5Validator
uses: Cyb3r-Jak3/html5validator-action@41633d488eb36e18fd1a95ffc83daf1bf22a75bd # v7.2.0
with:
root: _site/
css: true
skip_git_check: true
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