-
Notifications
You must be signed in to change notification settings - Fork 384
129 lines (123 loc) · 4.73 KB
/
gh-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
name: gh-pages
# Note: we have a foot in two camps here, maybe more
#
# - docs/ldml is the spec, and it gets special handling and generation. Ends up cldr-smoke for now
# - docs/rfc needs to end up somewhere. for now, generate to github.io
# - docs/site is an entire 'site' that gets deployed to what will be cldr.unicode.org
# This is now handled in site.yml
permissions:
pages: write
deployments: write
id-token: write
on:
pull_request:
push:
branches:
- main
- "maint/maint-*"
tags:
- "release-*"
# Only run if docs change.
paths:
- "tools/scripts/tr-archive/**"
- "docs/**"
- '.github/workflows/gh-pages.yml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: false
- name: Cache local npm repository
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-nodetr-${{ hashFiles('tools/scripts/tr-archive/package-lock.json') }}
restore-keys: |
${{ runner.os }}-nodetr-
nodetr-
- uses: nodenv/actions/node-version@v3 # setup using .node-version
- name: Run TR archiver
# Note: will update ToC if out of date
run: 'cd tools/scripts/tr-archive/ && npm ci && npm run build'
- name: Run Kbd Charts
run: 'cd docs/charts/keyboards && npm ci && npm run build'
- name: Upload tr35.zip
uses: actions/upload-artifact@v4
with:
name: tr35-spec
path: tools/scripts/tr-archive/tr35.zip
- name: 'Run TR link extractor (experimental)'
# Note: see CLDR-16526 for making this an error
run: 'cd tools/scripts/tr-archive/ && npm run extract-link-targets || (echo Warning, please fix these ; true)'
- name: Lint Markdown
# Warn, don't fail yet
run: npx markdownlint-cli *.md {specs,docs}/*.md || (echo Warning, please fix these ; true)
- name: Note any changes
# if the archiver had to update anything, or if anchors changed
run: git status ; git diff
- name: Restore lychee cache
uses: actions/cache@v3
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- name: Run lychee
uses: lycheeverse/lychee-action@v1
with:
args: "-n --cache --max-cache-age 10d docs/rfc docs/ldml"
fail: false
format: markdown
output: linkcheck.md
- name: Link Checker Summary
run: cat linkcheck.md >> $GITHUB_STEP_SUMMARY
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Build Jekyll part of the site (not spec, not site/)
run: |
gem install bundler github-pages kramdown-parser-gfm # should pull in jekyll, etc.
cd docs && github-pages build && mkdir -vp ../_site/ldml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Rearrange stuff
run: 'cp -vr tools/scripts/tr-archive/dist/* ./_site/ldml/ && cp tools/scripts/tr-archive/reports-v2.css ./_site/'
- name: Deploy to GitHub Pages (main)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v2
- name: Deploy to Smoketest
if: github.repository == 'unicode-org/cldr' && github.event_name == 'push'
shell: bash
env:
RSA_KEY_CCC: ${{ secrets.RSA_KEY_CCC }}
# the SSH port
CCC_USER: ${{ secrets.CCC_USER }}
CCC_PORT: 22
# the SSH host
CCC_HOST: cldr-smoke.unicode.org
# the ~/.ssh/known_hosts line mentioning SMOKETEST_HOST
CCC_KNOWNHOSTS: ${{ secrets.CCC_KNOWNHOSTS }}
run: |
echo "::group::Publish HTML"
echo "${RSA_KEY_CCC}" > ${HOME}/.key && chmod go= ${HOME}/.key
echo "${CCC_KNOWNHOSTS}" > ${HOME}/.knownhosts && chmod go= ${HOME}/.knownhosts
rsync -cav --delete-after -e "ssh -o UserKnownHostsFile=${HOME}/.knownhosts -i ${HOME}/.key -p ${CCC_PORT}" ./_site/ ${CCC_USER}@${CCC_HOST}:spec/$(basename ${GITHUB_REF_NAME})/
echo "::endgroup::"
echo "Now go to https://cldr-smoke.unicode.org/spec/"$(basename ${GITHUB_REF_NAME})
deploy:
if: github.repository == 'unicode-org/cldr' && github.event_name == 'push'
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
# only run one deployment at once.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true