-
Notifications
You must be signed in to change notification settings - Fork 62
137 lines (118 loc) · 4.95 KB
/
main.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
# This file can be used to configure the Node.js build for Antora ci without
# having Node installed locally. See 'transition-docs/antora_setup.adoc' in the root
# of this repo for details of how to use this file.
#
# The action add-and-commit will always commit the package-lock.json,
# package.json and Antora cache only if changes are made to the files.
#
# If the package-lock.json or package.json files are updated or new depends are
# installed, the 'npm ci' should be always ran thereafter to speed up build
# times. When ci is active, the package-lock.json and package.json files in root
# will not be updated.
#
# Uses the action actions-gh-page to publish pages to the gh-pages branch,
# including a required .nojekyll file that Antora requires for configuration.
#
# The 'actions/cache@v2' creates a new cache when the packages in
# package-lock.json file change, or when the workflow runner's operating system
# changes.
name: Build Docs
on:
push:
branches: [ master ]
# Initiate a build to pull in the wiki-ui repository changes.
repository_dispatch:
types: [wiki-ui-build]
jobs:
build:
#Static version is used to maintain stability.
runs-on: ubuntu-22.04
strategy:
matrix:
#Static version is used to maintain stability.
node-version: [12.17.0]
env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
ALGOLIA_IDX_NAME: ${{ secrets.ALGOLIA_IDX_NAME }}
steps:
- name: Clone the repo
uses: actions/checkout@v2
with:
# Number of commits to fetch. 0 indicates all history.
fetch-depth: 1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
# Display the sha of the build triggering the repository_dispatch event.
- name: wiki-ui-build
if: github.event.action == 'wiki-ui-build'
run: echo wiki-ui-build sha ${{ github.event.client_payload.sha }}
# Uncomment to write the default package.json file to the repo root.
# When used in conjunction with the action add-and-commit 'add' command, the
# file will be written to the repo for editing.
# - name: Install default package.json
# run: npm init --yes
# Uncomment when adding or updating dependencies in the package-lock.json
# and package.json files for ci.
# - name: Install Node
# run: npm i
# Uncomment during initial setup or when updating Antora to a new version.
# The action add-and-commit 'add' command will detect the changes and commit
# the package-lock.json and package.json files.
# Emoji support. Seems to be a direct implementation of AsciiDoctor ruby
# extension.
# see: https://github.com/mogztter/asciidoctor-emoji
# - name: Install Antora
# run: |
# npm i @antora/[email protected]
# npm i @antora/[email protected]
# npm i asciidoctor-emoji
# Uncomment after package-lock.json and package.json files are updated.
- name: Run with CI
run: npm ci
# - name: Audit Depends
# run: npm audit
- name: Build Docs
run: npm run buildDocs
# Detects any updates to package-lock.json and package.json and commits the
# files to root.
# see:
# https://github.com/marketplace/actions/add-commit?version=v4.1.0
# for use options.
- name: Commit Packages
uses: EndBug/add-and-commit@v4
with:
author_name: mitm001
author_email: [email protected]
message: "Commit files for CI workflow"
# Commits these files to root if and only if there are changes.
add: "package-lock.json package.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Antora will not copy folders outside the family tree so we move the
# resources into the build/site folder so the peaceiris action will commit
# the files.
- name: Copy Resources
run: cp -r ./docs/modules/ROOT/resources/* ./build/site/
# Commit changes to the gh-pages branch. Antora requires an empty
# '.nojekyll' be present in the branch due to certain directories starting
# with an underscore. This action has an option, set by default, to add that
# file for us on commit.
# see:
# https://github.com/marketplace/actions/github-pages-action?version=v3.6.1
# for use options.
- name: Deploy Docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Commits these files to gh-pages if and only if there are changes.
publish_dir: ./build/site
# Insert CNAME for repository.
cname: wiki.jmonkeyengine.org
- name: Purge Cloudflare caches
shell: bash
run: |
curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.JMONKEYENGINE_ORG_CLOUDFLARE_ZONE }}/purge_cache" \
-H "Authorization: Bearer ${{ secrets.JMONKEYENGINE_ORG_CLOUDFLARE_API_KEY }}" \
-H "Content-Type: application/json" --data '{"purge_everything":true}'