forked from legumeinfo/jekyll-legumeinfo
-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (152 loc) · 6.14 KB
/
build-deploy.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# workflow for building and deploying a Jekyll site to GitHub Pages
# based on https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml
name: Deploy Jekyll site to Pages
on:
push:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
## Use this job step to debug
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled && always() }}
# with:
# limit-access-to-actor: true
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
# Omit installation of packages in "test" group in Gemfile & prevent
# `bundle exec` from checking for the existence of those packages in
# the (generated) Gemfile.lock
BUNDLE_WITHOUT: test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- run: bundle exec jekyll build --profile --trace # --baseurl "${{ steps.pages.outputs.base_path }}" # sub-uri currently not supported by site
- uses: actions/cache/restore@v4
id: restore-cache-jbrowse
with:
path: ./_site/assets/js/jbrowse
key: jbrowse-${{ hashFiles('_data/datastore-metadata/**', '_scripts/jbrowse-tracks.sh', 'Makefile', 'assets/js/jbrowse-config.json') }}
- uses: actions/setup-node@v4
if: steps.restore-cache-jbrowse.outputs.cache-hit != 'true'
with:
node-version: 20
- name: Make JBrowse
if: steps.restore-cache-jbrowse.outputs.cache-hit != 'true'
run: |
make jbrowse
rm -rf assets/js/jbrowse/test_data
mv assets/js/jbrowse _site/assets/js
- uses: actions/cache/save@v4
id: save-cache-jbrowse
if: steps.restore-cache-jbrowse.outputs.cache-hit != 'true'
with:
path: ./_site/assets/js/jbrowse
key: jbrowse-${{ hashFiles('_data/datastore-metadata/**', '_scripts/jbrowse-tracks.sh', 'Makefile', 'assets/js/jbrowse-config.json') }}
# create artifact.tar from ./_site directory & upload as artifact named 'github-pages'
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install yamllint
run: python3 -mpip install --no-cache-dir yamllint
- name: Run yamllint
run: yamllint .
check-links:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: github-pages
- run: tar -xf artifact.tar && rm artifact.tar
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
- name: install htmlproofer
# need ruby >= 3.1 for html-proofer 5.x
run: gem install html-proofer -v 5.0.9
# Cache HTMLProofer external URL results for 30 days, but using actions/cache/restore
# and actions/cache/save so cache can still be saved when failure is reported
# https://github.com/gjtorikian/html-proofer/#caching-with-continuous-integration
- uses: actions/cache/restore@v4
id: restore-cache-htmlproofer
with:
path: ./tmp/.htmlproofer
key: html-proofer
- name: run htmlproofer
# ignore HTTP status 301 (htmlproofer strips trailing slashes)
run: |
htmlproofer --allow-missing-href --ignore-missing-alt --ignore-files '/\/uikit\/tests\//' --ignore-status-codes '301,403,503' --cache '{"timeframe": {"external": "30d"}}' --ignore-url '/germplasm-map.legumeinfo.org/,/pgrc-rpc.agr.gc.ca\/gringlobal\/search/'
# https://github.com/actions/cache/blob/main/save/README.md#always-save-cache
- uses: actions/cache/save@v4
id: save-cache-htmlproofer
if: always()
with:
path: ./tmp/.htmlproofer
key: html-proofer
pa11y:
# https://github.com/GSA/notifications-admin/pull/475
runs-on: ubuntu-20.04
needs: build
steps:
# need repository for .pa11yci
- uses: actions/download-artifact@v4
with:
name: github-pages
- run: tar -xf artifact.tar && rm artifact.tar
- run: npm install -g [email protected]
- run: busybox httpd -p 4000
# FIXME: patty-ci concurrency > 1 results in errors in this GA workflow
- run: |
printf '{"defaults": {"runners": ["axe"], "concurrency": 4, "useIncognitoBrowserContext": false}}\n' > .pa11yci
- run: pa11y-ci --sitemap http://0.0.0.0:4000/sitemap.xml --sitemap-exclude '/cmap-*' --sitemap-find '^/' --sitemap-replace http://0.0.0.0:4000/
# Deployment job
deploy:
# deploy if default branch for GitHub repo
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: [build, yamllint]
permissions:
id-token: write
pages: write
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4