-
Notifications
You must be signed in to change notification settings - Fork 3
166 lines (137 loc) · 5.34 KB
/
build-docs.yml
File metadata and controls
166 lines (137 loc) · 5.34 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Build Docs
on:
- push
- pull_request
# You can manually run this workflow.
- workflow_dispatch
# Improve CI concurrency by automatically cancelling outdated jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write # to push to gh-pages branch
jobs:
# ---------------------------------------------------------------------------------------
build:
# ---------------------------------------------------------------------------------------
runs-on: ubuntu-latest
steps:
- name: 🤘 Checkout Code
uses: actions/checkout@v6 # https://github.com/actions/checkout
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
graphviz \
default-jre-headless \
ruby \
ruby-dev
- name: Install Ruby gems
run: |
gem install --user-install \
asciidoctor \
asciidoctor-diagram \
rouge
echo "PATH=$HOME/.local/share/gem/ruby/3.2.0/bin:$PATH" >> $GITHUB_ENV
- name: Copy images
run: |
mkdir -p user-manual/images
cp -p images/* user-manual/images/
- name: Build HTML documentation
env:
REVNUMBER: ${{ github.sha }}
run: |
echo "Building user-manual..."
asciidoctor \
-a icons=font \
-a source-highlighter=rouge \
-a toc=left \
-a toclevels=3 \
-a revnumber=$REVNUMBER \
user-manual/en/book.adoc \
-o user-manual/en/index.html
echo "Building developer-manual..."
asciidoctor \
-r asciidoctor-diagram \
-a icons=font \
-a source-highlighter=rouge \
-a toc=left \
-a toclevels=3 \
-a revnumber=$REVNUMBER \
developer-manual/en/book.adoc \
-o developer-manual/en/index.html
echo "Building FAQ..."
asciidoctor \
-a icons=font \
-a source-highlighter=rouge \
-a revnumber=$REVNUMBER \
faq/faq.adoc \
-o faq/index.html
echo "Building index..."
asciidoctor README.adoc -o index.html
# - name: Build PDF documentation
# env:
# REVNUMBER: ${{ github.sha }}
# run: |
# asciidoctor -r asciidoctor-pdf -b pdf \
# -a pdf-stylesdir=pdf -a pdf-style=fife \
# -a pdf-fontsdir=pdf/fonts \
# -a revnumber=$REVNUMBER \
# user-manual/en/book.adoc -o user-manual/en/book.pdf
#
# asciidoctor -r asciidoctor-diagram -r asciidoctor-pdf -b pdf \
# -a pdf-stylesdir=pdf -a pdf-style=fife \
# -a pdf-fontsdir=pdf/fonts \
# -a revnumber=$REVNUMBER \
# developer-manual/en/book.adoc -o developer-manual/en/book.pdf
- name: Remove source files
run: |
find . -name '*.adoc' -type f -delete
# Push to gh-pages branch. This parts needs permissions contents: write.
- name: Push to gh-pages
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
run: |
echo "Tell git who we are"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git fetch origin
echo "checkout gh-pages branch without history (orphan)"
git checkout --orphan gh-pages
echo "remove all asciidoc (.adoc) source files"
git ls-files | grep '\.adoc$' | xargs git rm --cached || true
echo "remove unnecessary files"
git rm -f .gitattributes
git rm -rf .github/
echo "add & commit everything new"
git add --all
git commit -m "Updated Documentation. [skip ci]" || true
git push origin gh-pages --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# This step is only required, when using the deploy step below.
# Requires setting: Settings → Pages → Source: GitHub Actions
# - name: Upload documentation artifact
# uses: actions/upload-pages-artifact@v4 # https://github.com/actions/upload-pages-artifact
# with:
# path: ./
# # ---------------------------------------------------------------------------------------
# deploy:
# # ---------------------------------------------------------------------------------------
# needs: build
# if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
# # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
# permissions:
# contents: read
# pages: write # to deploy to Pages
# id-token: write # to verify the deployment originates from an appropriate source
# runs-on: ubuntu-latest
# environment:
# name: github-pages
# url: ${{ steps.deployment.outputs.page_url }}
# steps:
# - name: Setup GitHub Pages
# uses: actions/configure-pages@v5 # https://github.com/actions/configure-pages
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v4 # https://github.com/actions/deploy-pages