Skip to content

Commit d71ce44

Browse files
committed
Add docs workflow
1 parent b926efe commit d71ce44

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.github/config.env

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# The documentation repository name
2+
# User name defaults to github.repository_owner and can be changed in .github/workflows/docs.yml
3+
docs_repo=libscratchcpp-docs
4+
5+
# Whether to build documentation
6+
build_docs=1
7+
8+
# Whether to deploy documentation to the docs repository (requires build_docs=1)
9+
deploy_docs=1

.github/workflows/docs.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Update documentation
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Setup environment
13+
run: |
14+
sed -i -e '/^#/d' .github/config.env
15+
sed -i -e '/^$/d' .github/config.env
16+
cat .github/config.env >> "${GITHUB_ENV}"
17+
- uses: actions/checkout@v3
18+
with:
19+
repository: ${{ github.repository_owner }}/${{ env.docs_repo }}
20+
token: ${{ secrets.PUSH_TOKEN }}
21+
path: docs-repo
22+
- if: env.build_docs == 1
23+
name: Build docs
24+
uses: mattnotmitt/doxygen-action@v1.1.0
25+
with:
26+
doxyfile-path: "./Doxyfile"
27+
working-directory: "."
28+
- if: env.build_docs == 1 && env.deploy_docs == 1
29+
name: Deploy
30+
run: |
31+
cd docs-repo
32+
git checkout --orphan new-branch
33+
sudo chown -R $(whoami):$(whoami) ../docs
34+
git rm -rf .
35+
mv ../docs/* ./
36+
git config user.name "GitHub Actions Bot"
37+
git config user.email "<>"
38+
git add -A
39+
git commit -m "Upload docs"
40+
git branch -D master
41+
git branch -m master
42+
git push -f origin master

0 commit comments

Comments
 (0)