forked from OctoPrint/plugins.octoprint.org
-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (132 loc) Β· 5.27 KB
/
publish-to-github-pages.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
name: Build, validate & publish page
on:
schedule:
- cron: '0 */1 * * *'
push:
branches:
- gh-pages
pull_request:
branches:
- gh-pages
workflow_dispatch:
jobs:
build-validate-and-publish:
name: Publish to Github Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
path: src
- uses: actions/checkout@v2
with:
path: live
ref: master
- name: π Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: π Install requirements
run: |
pip install -r ./src/.github/scripts/requirements.txt
- name: πΊ Refresh youtube thumbnails
run: |
cd src
chmod +x .github/scripts/fetch_yt_preview
.github/scripts/fetch_yt_preview
- name: π΅οΈββ Validate front matter
run: |
cd src
python .github/scripts/validate_front_matter.py --action-output
- name: π Enrich front matter
if: github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request'
run: |
python ./src/.github/scripts/populate_additional_metadata.py
env:
GITHUB_TOKEN: ${{ secrets.metadata_token }}
- name: π Enrich notices
if: github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request'
run: |
python ./src/.github/scripts/populate_additional_notices.py
env:
GITHUB_TOKEN: ${{ secrets.metadata_token }}
- name: π Enrich py2 check overlays
if: github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request'
run: |
python ./src/.github/scripts/populate_py2_overlays.py
- name: π¦ Cache jekyll build bundle
uses: actions/cache@v2
with:
path: ./bundle
key: ${{ runner.os }}-jekyll-build-bundle
- name: π¨ Build page
run: |
docker run \
-v ${{ github.workspace }}/src:/srv/jekyll \
-v ${{ github.workspace }}/bundle:/usr/local/bundle \
jekyll/builder:3.8.6 /bin/bash -c "chmod 777 /srv/jekyll && jekyll build --trace --future --strict_front_matter"
- name: π Prepare live copy
run: |
rm -rf live/* || true
touch live/.nojekyll
cp -r src/_site/* live
- name: π Determine changed files
id: changed
run: |
cd live
git diff --name-only
changed=($(git diff --name-only))
json=`printf '%s\n' "${changed[@]}" | jq -R . | jq -c -s .`
echo "::set-output name=files::$json"
- name: π΅οΈββοΈ Validate plugins.json
if: contains( fromJSON( steps.changed.outputs.files ), 'plugins.json' )
run: |
docker run \
-v ${{ github.workspace }}/live:/json \
peterdavehello/jsonlint jsonlint -q /json/plugins.json
- name: π΅οΈββοΈ Validate notices.json
if: contains( fromJSON( steps.changed.outputs.files ), 'notices.json' )
run: |
docker run \
-v ${{ github.workspace }}/live:/json \
peterdavehello/jsonlint jsonlint -q /json/notices.json
- name: π΅οΈββοΈ Validate search.json
if: contains( fromJSON( steps.changed.outputs.files ), 'search.json' )
run: |
docker run \
-v ${{ github.workspace }}/live:/json \
peterdavehello/jsonlint jsonlint -q /json/search.json
#- name: π΅οΈββοΈ Run link check
# run: |
# docker run \
# -v ${{ github.workspace }}/_site:/mounted-site \
# mtlynch/htmlproofer /mounted-site --only-4xx --check-favicon --check-html --file-ignore '/\/mounted-site\/search\/index\.php/,/\/mounted-site\/by_(author|tag|date|name)\/index\.html/' --log-level ':debug'
#- name: π΅οΈββοΈ Run link check
# id: lc
# uses: peter-evans/link-checker@v1
# with:
# args: -v -r -d ./_site/ ./_site/
#- name: π΅οΈββοΈ Evaluate link check
# run: exit ${{ steps.lc.outputs.exit_code }}
- name: π Commit & deploy
if: github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request'
uses: EndBug/add-and-commit@v4
with:
cwd: "live"
ref: "master"
message: "deploy: ${{ github.sha }}"
author_name: 'github-actions[bot]'
author_email: 'github-actions[bot]@users.noreply.github.com'
- name: π§ Discord success notification
if: github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request'
env:
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
uses: Ilshidur/action-discord@master
with:
args: 'βοΈ Page build for plugins.octoprint.org was successful'
- name: π§ Discord failure notification
if: failure() && github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request'
env:
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
uses: Ilshidur/action-discord@master
with:
args: 'π« Page build for plugins.octoprint.org failed'