-
Notifications
You must be signed in to change notification settings - Fork 3
127 lines (120 loc) · 3.42 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
name: build_deploy
on:
push:
branches: [ main ]
pull_request:
repository_dispatch:
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
#
# Build the Jekyll site
#
build-site:
name: Build site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Calculate cache key
id: cache-key
run: |
echo "cache-key=$(scripts/metacachekey jekyll _config.yml)" >> $GITHUB_OUTPUT
- name: Restore cache
id: cache
uses: actions/cache@v4
with:
path: _site
key: ${{ steps.cache-key.outputs.cache-key }}
- name: Use Ruby
if: steps.cache.outputs.cache-hit != 'true'
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: 3.3
- name: Build site
if: steps.cache.outputs.cache-hit != 'true'
run: |
bundle exec jekyll build
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: jekyll-site
path: _site
#
# For each document category (administrative, standard, etc.),
# build using `metanorma site generate`.
#
build-docs:
name: Build ${{ matrix.doc_type }} docs
runs-on: ubuntu-latest
container:
image: metanorma/metanorma:latest
strategy:
matrix:
doc_type:
- name: administrative
- name: directive
- name: pending-publication
- name: public-review
- name: report
site_name: reports
- name: specification
site_name: specifications
- name: standard
site_name: standards
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 1
- name: Metanorma generate site
uses: actions-mn/build-and-publish@main
with:
destination: artifact
agree-to-terms: true
output-dir: _site/${{ matrix.doc_type.site_name || matrix.doc_type.name }}
artifact-name: metanorma-${{ matrix.doc_type.name }}-docs
source-path: src-documents
config-file: metanorma-${{ matrix.doc_type.name }}.yml
#
# At the very end, integrate them all with Jekyll.
#
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: [build-site, build-docs]
steps:
- name: Download Jekyll artifacts
uses: actions/download-artifact@v4
with:
name: jekyll-site
path: _site
- name: Download all doc artifacts
uses: actions/download-artifact@v4
with:
pattern: "metanorma-*-docs"
path: _site
merge-multiple: true
- name: Debug
run: |
ls -l
ls -l _site || :
ls -l _site/administrative || :
ls -l _site/standards || :
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4