-
Notifications
You must be signed in to change notification settings - Fork 63
99 lines (80 loc) · 3.06 KB
/
docgen.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
# Github Workflow to autogenerate docs and push to repository wiki
name: Autogenerate docs
on:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Checkout the wiki repository
uses: actions/checkout@v2
with:
repository: "${{ github.repository }}.wiki.git"
# As of Jul 2021, the default branch of a GitHub wiki is `master`, not `main`
ref: master
path: wiki
- name: Generate the Wiki Page using foundry
run: |
set -xe
forge doc --build --out wiki
- name: Configure the GitHub wiki identity
working-directory: wiki
# "${GITHUB_ACTOR}@users.noreply.github.com" is associated to the actor without real emails
run: |
set -xe
git config user.name "[bot] ${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Update the wiki page
working-directory: wiki
# --allow-empty may be good enough for almost all the situations,
# but maybe you want to do `if git commit ... ; then` if you don't want to record an empty commit
run: |
set -xe
git commit --allow-empty -m "update the wiki page by bot (${GITHUB_WORKFLOW})"
git push origin master
deploy:
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
# from https://github.com/actions/deploy-pages
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Generate the Wiki Page using foundry
run: |
set -xe
forge doc --build --out wiki
# build gh pages using https://github.com/marketplace/actions/upload-github-pages-artifact
- name: Upload to GitHub Pages
uses: actions/[email protected]
with:
path: wiki/book/
retention-days: 1
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1