-
Notifications
You must be signed in to change notification settings - Fork 2
158 lines (137 loc) · 4.24 KB
/
Copy pathci.yml
File metadata and controls
158 lines (137 loc) · 4.24 KB
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
name: ci
on:
push:
branches:
- main
pull_request:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: '0 6 * * 1' # Weekly Monday 06:00 UTC
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout site
uses: actions/checkout@v6
- name: Checkout schemas
uses: actions/checkout@v6
with:
repository: ISO-TC211/schemas
path: schemas
- name: Compute build cache key
id: cache-key
run: |
SCHEMAS_SHA=$(git -C schemas rev-parse HEAD)
echo "schemas_sha=${SCHEMAS_SHA}" >> "$GITHUB_OUTPUT"
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Cache LXR/SPA build artifacts
uses: actions/cache@v5
id: lxr-cache
with:
path: |
build/
site/
configs/
schemas_index.json
resources_index.json
key: lxr-v1-${{ hashFiles('generate_configs.rb', 'schemas/lxr_packages.yml', 'schemas/ljr_packages.yml', 'schemas/Gemfile.lock', 'Makefile') }}-${{ steps.cache-key.outputs.schemas_sha }}
- name: Setup Ruby (lutaml)
if: steps.lxr-cache.outputs.cache-hit != 'true'
run: BUNDLE_GEMFILE=schemas/Gemfile BUNDLE_PATH=vendor/bundle-lutaml bundle install
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- name: Install Node dependencies
run: npm ci
- name: Build lutaml frontends
if: steps.lxr-cache.outputs.cache-hit != 'true'
run: |
for gem_name in lutaml-jsonschema lutaml-xsd; do
GEM_DIR=$(BUNDLE_GEMFILE=schemas/Gemfile BUNDLE_PATH=vendor/bundle-lutaml bundle show "$gem_name" 2>/dev/null) || continue
[ -d "$GEM_DIR/frontend" ] || continue
cd "$GEM_DIR/frontend"
npm install
npm run build
cd -
done
- name: Build LXR packages and SPAs
if: steps.lxr-cache.outputs.cache-hit != 'true'
run: make configs lxr-spas
- name: Build Jekyll site
run: JEKYLL_ENV=production bundle exec jekyll build
- name: Upload site artifact
uses: actions/upload-artifact@v7
with:
name: site
path: _site/
retention-days: 1
deploy:
needs: build
if: github.ref == 'refs/heads/main' && github.event_name != 'schedule'
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download site
uses: actions/download-artifact@v8
with:
name: site
path: _site/
- name: Package for Pages
uses: actions/upload-pages-artifact@v5
with:
path: _site/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
link_checker:
needs: build
if: github.event_name != 'repository_dispatch'
runs-on: ubuntu-latest
steps:
- name: Download site artifact
uses: actions/download-artifact@v8
with:
name: site
path: _site/
- name: Restore lychee cache
uses: actions/cache@v5
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- name: Link Checker
uses: lycheeverse/lychee-action@v2
with:
args: >-
--verbose
--no-progress
--base '${{ github.workspace }}/_site'
--root-dir '${{ github.workspace }}/_site'
--cache
--max-cache-age 1d
--exclude 'https://committee\.iso\.org/'
--exclude 'https://www\.facebook\.com/'
--exclude 'https://twitter\.com/'
--exclude 'http://iso\.sparxcloud\.com/'
--exclude 'https://lutaml\.github\.io/'
--exclude '%23'
--exclude '.+/resources/?.*'
'_site/**/*.html'
fail: true