-
Notifications
You must be signed in to change notification settings - Fork 31
109 lines (89 loc) · 2.92 KB
/
ci.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
---
on:
pull_request:
push:
branches-ignore:
- gh-pages
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939
with:
bundler-cache: true
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
with:
node-version: '16'
- name: Cache node modules
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: npm-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ runner.os }}-build-${{ env.cache-name }}-
npm-${{ runner.os }}-build-
npm-
- name: Install NPM dependencies
run: npm install
- name: Test
run: bundle exec rspec
- name: Lint
run: bundle exec rubocop --parallel
- name: Validate schema
run: bundle exec rake schema
- name: Build
run: bundle exec rake build
- name: Upload built site
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
with:
name: site
path: build
retention-days: 1
htmlproofer:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939
with:
bundler-cache: true
- name: Download built site
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: site
path: build
- name: Test built site
run: bundle exec rake htmlproofer
publish:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
needs: build
permissions:
contents: write
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939
with:
bundler-cache: true
- name: Download built site
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: site
path: build
# Checkout stripped-down gh-pages branch to a subdirectory, for publishing
- name: Checkout gh-pages branch
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
with:
ref: gh-pages
path: tmp/publish
- name: Publish
run: |
git config --global user.email "[email protected]"
git config --global user.name "github-actions"
bundle exec rake publish CLONED_GH_PAGES_DIR="tmp/publish"