-
Notifications
You must be signed in to change notification settings - Fork 21
/
action.yml
197 lines (182 loc) · 7.43 KB
/
action.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: Spec Prod
author: "Sid Vishnoi"
description: "Build ReSpec/Bikeshed specs, validate output and publish to w3.org or GitHub pages"
branding:
icon: archive
color: blue
inputs:
TOOLCHAIN:
description: Possible values - 'respec', 'bikeshed'
SOURCE:
description: Source file path.
DESTINATION:
description: Destination path, relative to repository root.
BUILD_FAIL_ON:
description: Exit behaviour on errors.
default: fatal
VALIDATE_INPUT_MARKUP:
description: Validate input markup
default: "false"
VALIDATE_LINKS:
description: Validate hyperlinks
default: "false"
required: false
VALIDATE_MARKUP:
description: Validate markup
default: "true"
VALIDATE_WEBIDL:
description: Validate Web IDL
default: "true"
VALIDATE_PUBRULES:
description: Validate against W3C Publication Rules
default: "false"
GH_PAGES_BRANCH:
description: Provide a branch name to deploy to GitHub pages.
GH_PAGES_BUILD_OVERRIDE:
description: Override Bikeshed's metadata or ReSpec's respecConfig for GitHub Pages deployment.
GH_PAGES_TOKEN:
description: GitHub Personal access token. Required only if the default GitHub actions token doesn't have enough permissions.
W3C_ECHIDNA_TOKEN:
description: Echidna token
W3C_WG_DECISION_URL:
description: A URL to the working group decision to use auto-publish (usually from a w3c mailing list).
W3C_BUILD_OVERRIDE:
description: Override Bikeshed's metadata or ReSpec's respecConfig for W3C deployment and validations.
W3C_NOTIFICATIONS_CC:
description: Comma separated list of email addresses to CC
ARTIFACT_NAME:
description: Name for build artifact
runs:
using: composite
steps:
# Both pnpm and setup-node expect paths relative to checked-out repo. But we
# want to use package.json and .nvmrc from action repo. So, we'll provide
# them a path relative to GITHUB_WORKSPACE
# See https://github.com/actions/setup-node/issues/852
- id: action_relative_path
run: |
action_path=$(node -p 'require("path").relative(process.env.GITHUB_WORKSPACE, "${{ github.action_path }}")')
echo "action_path=${action_path}" >> "$GITHUB_OUTPUT"
shell: bash
- uses: pnpm/action-setup@v4
with:
package_json_file: ${{ steps.action_relative_path.outputs.action_path }}/package.json
- uses: actions/setup-node@v4
with:
node-version-file: ${{ steps.action_relative_path.outputs.action_path }}/.nvmrc
- name: Set up action
run: |
echo "::group::Set up action"
pnpm -C ${{ github.action_path }} install --no-optional
pnpm -C ${{ github.action_path }} build
echo "::endgroup::"
shell: bash
env:
FORCE_COLOR: "true"
PUPPETEER_SKIP_DOWNLOAD: "1"
- name: Prepare
id: prepare
run: |
echo "::group::Prepare"
node --enable-source-maps ${{ github.action_path }}/src/prepare.js
echo "::endgroup::"
shell: bash
env:
INPUTS_USER: ${{ toJSON(inputs) }}
INPUTS_GITHUB: ${{ toJSON(github) }}
- name: Setup toolchain
run: |
echo "::group::Setup toolchain"
node --enable-source-maps ${{ github.action_path }}/src/setup.js
echo "::endgroup::"
shell: bash
env:
INPUTS_TOOLCHAIN: ${{ steps.prepare.outputs.build && fromJson(steps.prepare.outputs.build).toolchain }}
- name: Validate input markup
run: |
echo "::group::Validate input markup"
node --enable-source-maps ${{ github.action_path }}/src/validate-input-markup.js
echo "::endgroup::"
shell: bash
env:
INPUTS_VALIDATE_INPUT_MARKUP: ${{ steps.prepare.outputs.validate && fromJson(steps.prepare.outputs.validate).input_markup }}
INPUTS_BUILD: ${{ steps.prepare.outputs.build && toJSON(fromJson(steps.prepare.outputs.build)) }}
- name: Generate Static HTML
id: build
run: |
echo "::group::Generate Static HTML"
node --enable-source-maps ${{ github.action_path }}/src/build.js
echo "::endgroup::"
shell: bash
env:
INPUTS_BUILD: ${{ steps.prepare.outputs.build && toJSON(fromJson(steps.prepare.outputs.build)) }}
- name: Upload Build Artifacts
id: upload-build-artifacts
uses: actions/upload-artifact@v4
with:
path: |-
${{ steps.build.outputs.gh && fromJson(steps.build.outputs.gh).dest }}
${{ steps.build.outputs.w3c && fromJson(steps.build.outputs.w3c).dest }}
name: ${{ steps.prepare.outputs.build && fromJson(steps.prepare.outputs.build).artifactName }}
retention-days: 5
- name: Validate hyperlinks
if: ${{ success() && steps.prepare.outputs.validate && fromJson(steps.prepare.outputs.validate).links }}
run: |
echo "::group::Validate hyperlinks"
node --enable-source-maps ${{ github.action_path }}/src/validate-links.js
echo "::endgroup::"
shell: bash
env:
OUTPUTS_BUILD: ${{ steps.build.outputs.w3c && toJson(fromJson(steps.build.outputs.w3c)) }}
- name: Validate markup
run: |
echo "::group::Validate markup"
node --enable-source-maps ${{ github.action_path }}/src/validate-markup.js
echo "::endgroup::"
shell: bash
env:
INPUTS_VALIDATE_MARKUP: ${{ steps.prepare.outputs.validate && fromJson(steps.prepare.outputs.validate).markup }}
OUTPUTS_BUILD: ${{ steps.build.outputs.w3c && toJson(fromJson(steps.build.outputs.w3c)) }}
- name: Validate pubrules (Specberus)
run: |
echo "::group::Validate pubrules (Specberus)"
node --enable-source-maps ${{ github.action_path }}/src/validate-pubrules.js
echo "::endgroup::"
shell: bash
env:
INPUTS_VALIDATE_PUBRULES: ${{ steps.prepare.outputs.validate && fromJson(steps.prepare.outputs.validate).pubrules }}
OUTPUTS_BUILD: ${{ steps.build.outputs.w3c && toJson(fromJson(steps.build.outputs.w3c)) }}
- name: Validate Web IDL
run: |
echo "::group::Validate Web IDL"
node --enable-source-maps ${{ github.action_path }}/src/validate-webidl.js
echo "::endgroup::"
shell: bash
env:
INPUTS_VALIDATE_WEBIDL: ${{ steps.prepare.outputs.validate && fromJson(steps.prepare.outputs.validate).webidl }}
OUTPUTS_BUILD: ${{ steps.build.outputs.w3c && toJson(fromJson(steps.build.outputs.w3c)) }}
- name: Deploy to GitHub pages
run: |
echo "::group::Deploy to GitHub pages"
node --enable-source-maps ${{ github.action_path }}/src/deploy-gh-pages.js
echo "::endgroup::"
shell: bash
env:
INPUTS_DEPLOY: ${{ steps.prepare.outputs.deploy && toJson(fromJson(steps.prepare.outputs.deploy).ghPages) }}
OUTPUT_DIR: ${{ steps.build.outputs.gh && fromJson(steps.build.outputs.gh).root }}
- name: Deploy to W3C
run: |
echo "::group::Deploy to W3C"
node --enable-source-maps ${{ github.action_path }}/src/deploy-w3c-echidna.js
echo "::endgroup::"
shell: bash
env:
INPUTS_DEPLOY: ${{ steps.prepare.outputs.deploy && toJson(fromJson(steps.prepare.outputs.deploy).w3c) }}
OUTPUTS_BUILD: ${{ steps.build.outputs.w3c && toJson(fromJson(steps.build.outputs.w3c)) }}
- name: End
if: ${{ failure() }}
shell: bash
run: |
# Failed
node -e 'require("@actions/core").setFailed("Failed. See details above.")'
working-directory: ${{ github.action_path }}