Skip to content

Commit ad64b49

Browse files
committed
Add GitHub actions workflow for updating draft
Add a workflow that will trigger on pushes to draft which: * Builds the HTML version of the spec (using the Makefile) in a build subdirectory * Moves the built HTML file as an index.html to a 'draft' subdirectory * Switches to the gh-pages branch and moves the contents of the build subdirectory into the repo root * Commits the generated HTML files and pushes them to the gh-pages branch on GitHub Signed-off-by: Joshua Lock <[email protected]>
1 parent 5e8d14e commit ad64b49

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/draft.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Update draft specification
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: draft
6+
7+
jobs:
8+
build-draft:
9+
name: Make draft spec release
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Set up Python
13+
uses: actions/setup-python@3105fb18c05ddd93efea5f9e0bef7a03a6e9e7df
14+
with:
15+
python-version: 3.x
16+
17+
- name: Find pip cache dir
18+
id: pip-cache
19+
run: echo "::set-output name=dir::$(pip cache dir)"
20+
21+
- name: pip cache
22+
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6
23+
with:
24+
# Use the os dependent pip cache directory found above
25+
path: ${{ steps.pip-cache.outputs.dir }}
26+
# A match with 'restore-keys' is used as fallback
27+
key: ${{ runner.os }}-pip-
28+
29+
- name: Clone
30+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
31+
32+
- name: Build specification
33+
run: |
34+
python -m pip install bikeshed
35+
mkdir build && cd build
36+
make -f ../Makefile draft
37+
38+
- name: Switch branch
39+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
40+
with:
41+
ref: gh-pages
42+
clean: false
43+
44+
- name: Push generated specification
45+
run: |
46+
git config user.name "TUF Specification Automation"
47+
git config user.email [email protected]
48+
rm -fr draft
49+
mv build/* .
50+
rmdir build
51+
git add .
52+
git commit -m "Publish latest specification"
53+
git push

0 commit comments

Comments
 (0)