generated from Stichting-CROW/respec-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (127 loc) · 4.97 KB
/
lifecycle.yaml
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
name: Publish review or reference version
on:
workflow_dispatch:
inputs:
documentShortName:
description: "Document short name (name of the folder inside `docs`)"
required: true
nextLifecyclePhase:
description: "Publish with status (http://docs.crow.nl/respec-design/stichting-crow/#specstatus-formal)"
required: true
default: "DEF"
type: choice
options:
- "00-DOC-Document"
- "00-IR-In review"
- "30-CR-Committee review"
- "40-PR-Public review"
- "50-OR-Open review"
- "60-DEF-Approved"
- "95-REPL-Superceded"
- "95-RESC-Rescinded"
- "90-RQR-Requires review"
reviewDateEnd:
description: "Review comments accepted through date (provide: '2022-06-21')"
required: false
hypothesisComments:
description: "Allow review comments through Hypothes.is"
required: false
type: boolean
emailComments:
description: "Allow review comments through e-mail (provide: e-mail address)."
required: false
prevVersion:
description: "Link to previous lifecycle (non-draft) (provide: URL link)"
required: false
env:
DOCS_HOME: "https://docs.crow.nl"
permissions:
contents: write
jobs:
build:
name: Build spec as archive
runs-on: ubuntu-latest
outputs:
docfilename: ${{ steps.output1.outputs.docfilename }}
destination: ${{ steps.output1.outputs.destination }}
steps:
- name: Get code 🛂
uses: actions/checkout@v2
- name: Save today's date 📅
run: |
echo "TODAY=$(date +%Y%m%d)" >> $GITHUB_ENV
echo "TODAY_DASHED=$(date +%Y-%m-%d)" >> $GITHUB_ENV
echo "SPEC_STATUS=$(echo '${{ github.event.inputs.nextLifecyclePhase }}' | cut -d'-' -f2)" >> $GITHUB_ENV
echo "REPO_NAME=$(echo '${{ github.repository }}' | cut -d'/' -f2 )" >> $GITHUB_ENV
- name: Calculate document title 🧾
run: |
echo "DOCUMENT_FULL_NAME=${{ github.event.inputs.documentShortName }}@$SPEC_STATUS-$TODAY" >> $GITHUB_ENV
- name: Calculate destination 🏖
run: |
echo "DESTINATION=docs/v/$DOCUMENT_FULL_NAME" >> $GITHUB_ENV
echo "LIVE_URL=$DOCS_HOME/$REPO_NAME/v/$DOCUMENT_FULL_NAME" >> $GITHUB_ENV
- name: Set outputs
id: output1
run: |
echo "::set-output name=docfilename::$(echo $DOCUMENT_FULL_NAME)"
echo "::set-output name=destination::$(echo $DESTINATION)"
- name: Generate archive 📦
uses: w3c/spec-prod@v2
# This version only pushes on event: push. Therefore upload-respec-artifact
with:
SOURCE: docs/${{ github.event.inputs.documentShortName }}/index.html
DESTINATION: ${{ env.DESTINATION }}/index.html
TOOLCHAIN: respec
GH_PAGES_BRANCH: gh-pages
BUILD_FAIL_ON: nothing
VALIDATE_WEBIDL: false
VALIDATE_LINKS: false
VALIDATE_MARKUP: false
VALIDATE_PUBRULES: false
GH_PAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_PAGES_BUILD_OVERRIDE: |
specStatus: ${{ env.SPEC_STATUS }}
publishDate: ${{ env.TODAY_DASHED }}
reviewDateEnd: ${{ github.event.inputs.reviewDateEnd }}
hypothesisComments: ${{ github.event.inputs.hypothesisComments }}
emailComments: ${{ github.event.inputs.emailComments }}
prevVersion: ${{ github.envent.inputs.prevVersion }}
deploy:
name: Upload spec archive to gh-pages:v/
runs-on: ubuntu-latest
needs: build
steps:
- name: Get code 🛂
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- run: |
git switch gh-pages
echo "Contains: $(ls)"
- name: Expand, extract and deploy archive 🚀
id: upload-respec-artifact
uses: actions/download-artifact@v3
with:
name: spec-prod-result
- run: |
echo "Contains after download $(ls -R)"
mkdir -p v/
mv *.gh/docs/v/* v/
- name: Create PDF from HTML
uses: frnode/html-to-pdf-action@v1.0.1
with:
htmlFile: v/${{ needs.build.outputs.docfilename }}/index.html
outputFile: v/${{ needs.build.outputs.docfilename }}/${{ needs.build.outputs.docfilename }}.pdf
pdfOptions: '{"format": "A4", "scale": 0.9, "printBackground": true}'
- name: Push new document to repo 🚀
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: gh-pages
create_branch: true
file_pattern: v/** # only v/, ignore the expanded zip
commit_message: |
doc: publish ${{ env.DOCUMENT_FULL_NAME }}
Reason: run lifecycle.yaml by ${{ github.actor }}
commit_user_name: stichting-crow-klusjesbot
commit_user_email: 84876605+stichting-crow-klusjesbot@users.noreply.github.com