-
-
Notifications
You must be signed in to change notification settings - Fork 11
55 lines (54 loc) · 1.68 KB
/
publish-docs.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
name: Publish documentation
on:
release: # Run when stable releases are published
types: [released]
workflow_dispatch: # Run on-demand
inputs:
ref:
description: Git ref to build docs from
required: true
default: main
type: string
jobs:
push-branch:
name: Build & push docs
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Check out from release
if: github.event_name == 'release'
uses: actions/checkout@v4
- name: Check out from manual input
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: yarn
- run: yarn install
- run: yarn build
- name: Clone docs branch
uses: actions/checkout@v4
with:
path: docs-branch
ref: oddleventy-docs
- name: Commit & push to docs branch
run: |
SHA=$(git rev-parse HEAD)
cd docs-branch
rm -rf herman/docs
mkdir -p herman/docs
cp -r ${{ github.workspace }}/docs/ herman/
git config user.name github-actions
git config user.email github-actions@github.com
git add -A .
git commit --allow-empty \
-m "Update from https://github.com/${{ github.repository }}/commit/$SHA" \
-m "Full log: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
git push origin oddleventy-docs