-
Notifications
You must be signed in to change notification settings - Fork 42
72 lines (56 loc) · 1.97 KB
/
deploy-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
68
69
70
71
72
name: 🚀 Deploy docs
on:
release:
branches:
- master
types:
- published
pull_request:
branches:
- master
jobs:
test:
name: 🚀 Deploy docs
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: 📋 Gather branch information
id: version_info
continue-on-error: true
run: |
version=${GITHUB_REF##*/}
echo "##[set-output name=version;]${version}"
echo "We're running on version ${version}"
- name: 🛠️ Append the current version to the introduction document
run: |
sed -i "1 s|$| ${{ steps.version_info.outputs.version }}|" apidoc/introduction.md
- name: 🏃🏼 Run apidoc
run: |
npx [email protected] -i . -f js -e node_modules
- name: 🚀 Deploy apidocs for git tags
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
run: |
set -e
# reset the changes to please git
git checkout -- apidoc/introduction.md
# checkout gh-pages branch
git remote set-branches --add origin gh-pages
git fetch
git checkout -t origin/gh-pages
# delete everything except for the doc folder
find . ! \( -path './.git' -prune \) ! \( -path './doc' -prune \) ! -name '.' ! -name '..' -print0 | xargs -0 rm -rf --
# move content of doc to .
mv doc/* .
# delete doc folder
rm -rf doc
# add .nojekyll file
touch .nojekyll
# add everything
git add -A
# tell git who you are
git config user.name "GitHub-CI"
git config user.email "[email protected]"
# commit
git commit -m "apidoc build for ${{ steps.version_info.outputs.version }} by GitHub Actions"
# push to github
git push "https://${{ github.token }}@github.com/${{ github.repository }}.git" gh-pages