-
Notifications
You must be signed in to change notification settings - Fork 11
67 lines (58 loc) · 1.86 KB
/
publish-docs.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
name: Generate documentation
on:
# Workflow dispatch is used for manual triggers
workflow_dispatch:
inputs:
message:
description: "A message to shown in the changelog"
default: ""
required: false
type: string
# Workflow call is used for called from another workflow
workflow_call:
inputs:
message:
description: "A message to shown in the changelog"
default: ""
required: false
type: string
env:
GITHUB_PAGES_BRANCH: gh-pages
jobs:
publish-docs:
runs-on: ubuntu-latest
steps:
- name: "Checkout GitHub Action"
uses: actions/checkout@main
- name: "Setup node"
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
cache-dependency-path: documentation/yarn.lock
- name: Download CHANGELOG
uses: actions/download-artifact@v3
with:
name: CHANGELOG
- name: "Add changelog"
shell: bash
run: |
sed -i -e '1i${{ inputs.message }}\' CHANGELOG.md
cp CHANGELOG.md documentation/src/pages/changelog.md
- name: Install dependencies and build website
run: |
cd documentation
yarn install --frozen-lockfile
yarn build
- name: Push static files to Github Pages branch
run: |
cd documentation/build
CREATED_FROM_REF=$(git rev-parse --short HEAD)
git init
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git checkout -b $GITHUB_PAGES_BRANCH
git remote add $GITHUB_PAGES_BRANCH https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/equinor/template-fastapi-react
git add .
git commit -m "Built from commit '$CREATED_FROM_REF'"
git push -f --set-upstream gh-pages gh-pages