-
Notifications
You must be signed in to change notification settings - Fork 5
106 lines (98 loc) · 3.31 KB
/
documentation.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
100
101
102
103
104
105
106
name: Documentation
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
inputs:
ref:
description: 'The branch, tag or SHA to checkout'
required: true
jobs:
build:
name: Build Documentation
runs-on: ubuntu-latest
if: github.repository_owner == 'RealShadowNova'
outputs:
NAME: ${{ steps.env.outputs.NAME }}
TYPE: ${{ steps.env.outputs.TYPE }}
SHA: ${{ steps.env.outputs.SHA }}
steps:
- name: Checkout Project
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
ref: ${{ github.event.inputs.ref || '' }}
- name: Use Node.js v16
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
with:
node-version: 16
cache: yarn
registry-url: https://registry.yarnpkg.com/
- name: Install Dependencies
run: yarn --immutable
- name: Build Documentation
run: yarn docs
- name: Upload Documentation Artifacts
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
with:
name: docs
path: docs/api.json
- name: Set Output
id: env
run: |
echo "::set-output name=NAME::${GITHUB_REF_NAME}"
echo "::set-output name=TYPE::${GITHUB_REF_TYPE}"
echo "::set-output name=SHA::${GITHUB_SHA}"
upload:
name: Upload Documentation
needs: build
runs-on: ubuntu-latest
env:
NAME: ${{ github.event.inputs.ref || needs.build.outputs.NAME }}
TYPE: ${{ needs.build.outputs.TYPE }}
SHA: ${{ needs.build.outputs.SHA }}
steps:
- name: Checkout Project
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Use Node.js v16
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
with:
node-version: 16
cache: yarn
registry-url: https://registry.yarnpkg.com/
- name: Install Dependencies
run: yarn --immutable
- name: Download Documentation Artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3
with:
name: docs
path: docs
- name: Checkout Documentation Project
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
repository: 'RealShadowNova/docs'
token: ${{ secrets.NOVA_TOKEN }}
path: 'out'
- name: Move Documentation
if: ${{ (github.event.inputs.ref || env.TYPE) == 'tag' }}
env:
SEMVER: ${{ env.NAME }}
run: |
mkdir -p out/docs/typedoc-json-parser
mv docs/api.json out/docs/typedoc-json-parser/${SEMVER}.json
- name: Move Documentation
if: ${{ !github.event.inputs.ref && env.TYPE == 'branch' }}
run: |
mkdir -p out/docs/typedoc-json-parser
mv docs/api.json out/docs/typedoc-json-parser/${NAME}.json
- name: Commit & Push
run: |
cd out
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add .
git commit -m "docs(typedoc-json-parser): build for ${TYPE} ${NAME}: ${SHA}" || true
git pull
git push