1
- name : Build, validate & publish page
1
+ name : Build, validate & deploy page
2
2
3
3
on :
4
4
schedule :
12
12
workflow_dispatch :
13
13
14
14
jobs :
15
- build-validate-and-publish :
16
- name : Publish to Github Pages
15
+ build :
16
+ name : Build and validate
17
17
runs-on : ubuntu-latest
18
18
steps :
19
19
- uses : actions/checkout@v3
20
- with :
21
- path : src
22
-
23
- - uses : actions/checkout@v3
24
- with :
25
- path : live
26
- ref : master
27
20
28
21
- name : 🐍 Set up Python 3.7
29
22
uses : actions/setup-python@v4
@@ -32,108 +25,68 @@ jobs:
32
25
33
26
- name : 🐍 Install requirements
34
27
run : |
35
- pip install -r ./src/ .github/scripts/requirements.txt
28
+ pip install -r ./.github/scripts/requirements.txt
36
29
37
30
- name : 📺 Refresh youtube thumbnails
38
31
run : |
39
- cd src
40
32
chmod +x .github/scripts/fetch_yt_preview
41
33
.github/scripts/fetch_yt_preview
42
34
43
35
- name : 🕵️♂ Validate front matter
44
36
run : |
45
- cd src
46
37
python .github/scripts/validate_front_matter.py --action-output
47
38
48
39
- name : 🏗 Enrich front matter
49
40
if : github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request'
50
41
run : |
51
- python ./src/ .github/scripts/populate_additional_metadata.py
42
+ python ./.github/scripts/populate_additional_metadata.py
52
43
env :
53
44
GITHUB_TOKEN : ${{ secrets.metadata_token }}
54
45
55
46
- name : 🏗 Enrich notices
56
47
if : github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request'
57
48
run : |
58
- python ./src/ .github/scripts/populate_additional_notices.py
49
+ python ./.github/scripts/populate_additional_notices.py
59
50
env :
60
51
GITHUB_TOKEN : ${{ secrets.metadata_token }}
61
52
62
53
- name : 🏗 Enrich py2 check overlays
63
54
if : github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request'
64
55
run : |
65
- python ./src/ .github/scripts/populate_py2_overlays.py
56
+ python ./.github/scripts/populate_py2_overlays.py
66
57
67
- - name : 📦 Cache jekyll build bundle
68
- uses : actions/cache@v3
58
+ - name : 💎 Set up Ruby 3
59
+ uses : ruby/setup-ruby@v1
69
60
with :
70
- path : ./bundle
71
- key : ${{ runner.os }}-jekyll-build-bundle
72
-
61
+ ruby-version : ' 3.2 '
62
+ bundler-cache : true
63
+
73
64
- name : 🔨 Build page
74
65
run : |
75
- docker run \
76
- -v ${{ github.workspace }}/src:/srv/jekyll \
77
- -v ${{ github.workspace }}/bundle:/usr/local/bundle \
78
- jekyll/builder:3.8.6 /bin/bash -c "chmod 777 /srv/jekyll && jekyll build --trace --future --strict_front_matter"
79
-
80
- - name : 🔄 Prepare live copy
81
- run : |
82
- rm -rf live/* || true
83
- touch live/.nojekyll
84
- cp -r src/_site/* live
85
-
86
- - name : 🔎 Determine changed files
87
- id : changed
88
- run : |
89
- cd live
90
- git diff --name-only
91
- changed=($(git diff --name-only))
92
- json=`printf '%s\n' "${changed[@]}" | jq -R . | jq -c -s .`
93
- echo "files=$json" >> $GITHUB_OUTPUT
66
+ bundle exec jekyll build --future --trace
94
67
95
68
- name : 🕵️♂️ Validate plugins.json
96
- if : contains( fromJSON( steps.changed.outputs.files ), 'plugins.json' )
97
69
run : |
98
70
docker run \
99
- -v ${{ github.workspace }}/live :/json \
71
+ -v ${{ github.workspace }}/_site :/json \
100
72
peterdavehello/jsonlint jsonlint -q /json/plugins.json
101
73
102
74
- name : 🕵️♂️ Validate notices.json
103
- if : contains( fromJSON( steps.changed.outputs.files ), 'notices.json' )
104
75
run : |
105
76
docker run \
106
- -v ${{ github.workspace }}/live :/json \
77
+ -v ${{ github.workspace }}/_site :/json \
107
78
peterdavehello/jsonlint jsonlint -q /json/notices.json
108
79
109
80
- name : 🕵️♂️ Validate search.json
110
- if : contains( fromJSON( steps.changed.outputs.files ), 'search.json' )
111
81
run : |
112
82
docker run \
113
- -v ${{ github.workspace }}/live :/json \
83
+ -v ${{ github.workspace }}/_site :/json \
114
84
peterdavehello/jsonlint jsonlint -q /json/search.json
115
85
116
- # - name: 🕵️♂️ Run link check
117
- # run: |
118
- # docker run \
119
- # -v ${{ github.workspace }}/_site:/mounted-site \
120
- # 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'
121
-
122
- # - name: 🕵️♂️ Run link check
123
- # id: lc
124
- # uses: peter-evans/link-checker@v1
125
- # with:
126
- # args: -v -r -d ./_site/ ./_site/
127
- # - name: 🕵️♂️ Evaluate link check
128
- # run: exit ${{ steps.lc.outputs.exit_code }}
129
-
130
- - name : 🚀 Commit & deploy
131
- if : github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request'
132
- uses : EndBug/add-and-commit@v9
86
+ - name : ⬆ Upload pages artifact
87
+ uses : actions/upload-pages-artifact@v1
133
88
with :
134
- cwd : " live"
135
- message : " deploy: ${{ github.sha }}"
136
- default_author : github_actions
89
+ path : ./_site
137
90
138
91
- name : 📧 Discord success notification
139
92
if : github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request'
@@ -150,3 +103,17 @@ jobs:
150
103
uses : Ilshidur/action-discord@master
151
104
with :
152
105
args : ' 🚫 Page build for plugins.octoprint.org failed'
106
+
107
+ deploy :
108
+ name : " Deploy"
109
+ runs-on : ubuntu-latest
110
+ needs : build
111
+
112
+ environment :
113
+ name : github-pages
114
+ url : ${{ steps.deployment.outputs.page_url }}
115
+
116
+ steps :
117
+ - name : Deploy to GitHub Pages
118
+ id : deployment
119
+ uses : actions/deploy-pages@v1
0 commit comments