Skip to content

Commit 4a4d630

Browse files
committed
initial refactoring commit
0 parents  commit 4a4d630

File tree

814 files changed

+1052996
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

814 files changed

+1052996
-0
lines changed

.github/workflows/build.yml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: build
2+
on:
3+
push:
4+
branches: [ main, develop, gh-build, fresh ]
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
# runs on weblate commit
11+
weblate-commit-build:
12+
if: ${{ contains(github.event.head_commit.message, 'Translated using Weblate') }}
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: TODO - start full build (delayed)
16+
run: echo "TODO - start delayed full build, maybe 15mins?"
17+
18+
# on regular commit (auto excludes self-commited pot/po files)
19+
full-build:
20+
if: ${{ ! contains(github.event.head_commit.message, 'Translated using Weblate') }}
21+
concurrency:
22+
group: ${{ github.ref }}
23+
cancel-in-progress: true
24+
25+
runs-on: ubuntu-latest
26+
container:
27+
image: sphinxdoc/sphinx
28+
#options: --user 1001 (only if we don't need apt-get)
29+
30+
env:
31+
MAIN_LANGS: en
32+
OTHER_LANGS: de es fr ru nl it ja el bg da et fi lv lt pl pt ro sv sk sl cs hu zh_CN
33+
34+
steps:
35+
- name: Install git
36+
run: |
37+
apt-get -y update
38+
apt-get -y install git ssh curl
39+
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
43+
- name: additional python packages
44+
run: pip3 install -r requirements.txt
45+
46+
- name: quick build docs
47+
run: |
48+
mkdir -p dist/en
49+
mkdir -p build/en/doctrees
50+
sphinx-build -j auto -b html -D language=en -d build/en/doctrees source dist/en
51+
rm -rf dist/en/_sources
52+
53+
- name: upload quick build artifact
54+
id: upload-quick
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: generated documentation (en)
58+
path: dist
59+
60+
- name: trigger docs server to download artifact
61+
uses: appleboy/[email protected]
62+
with:
63+
host: ${{ secrets.DOCS_HOST }}
64+
username: docs
65+
port: ${{ secrets.DOCS_PORT }}
66+
key: ${{ secrets.DEPLOY_AUTH_KEY }}
67+
script: /var/www/docs/deploy/github-trigger.sh en ${{ steps.upload-quick.outputs.artifact-id }} ${{ secrets.DOWNLOAD_TOKEN }}
68+
69+
- name: build pot files
70+
run: sphinx-build -b gettext source locales/
71+
72+
- name: build po files from pot files
73+
shell: bash
74+
run: |
75+
lang=($OTHER_LANGS)
76+
sphinx-intl update -p locales/ ${lang[@]/*/'-l '&' '}
77+
78+
- name: prepare commit into self
79+
run: |
80+
cp -r locales locales.full
81+
rm -rf locales/.doctrees
82+
83+
- name: commit `locales` into repository (on changes)
84+
shell: bash
85+
run: |
86+
# not needed if run on --user 1001
87+
git config --global --add safe.directory $(pwd)
88+
git config --global user.name "GitHub Action"
89+
git config --global user.email "[email protected]"
90+
if (git commit -m "Automated locales generation" locales); then
91+
git push
92+
fi
93+
94+
- name: put original `locales` back
95+
run: |
96+
rm -rf locales
97+
cp -r locales.full locales
98+
99+
- name: TODO - weblate
100+
shell: bash
101+
run: |
102+
echo "trigger pull"
103+
echo "trigger deepl"
104+
echo "trigger commit"
105+
echo "trigger push"
106+
# for lang in $OTHER_LANGS
107+
# do
108+
# bash trigger_weblate.sh ${{ secrets.WEBLATE_API_URL }} $lang ${{ secrets.WEBLATE_TOKEN }}
109+
# done
110+
111+
- name: build full docs
112+
run: |
113+
# one _images is enough
114+
mv dist/en/_images dist
115+
116+
cp -r locales source/locales
117+
for lang in $MAIN_LANGS $OTHER_LANGS
118+
do
119+
mkdir -p dist/$lang
120+
mkdir -p build/$lang/doctrees
121+
sphinx-build -j auto -b html -D language=$lang -d build/$lang/doctrees source dist/$lang
122+
rm -rf dist/$lang/_sources dist/$lang/_images
123+
done
124+
125+
- name: upload full build artifact
126+
id: upload-full
127+
uses: actions/upload-artifact@v4
128+
with:
129+
name: generated documentation (all)
130+
path: dist
131+
132+
- name: trigger docs server to download (FULL) artifact
133+
uses: appleboy/[email protected]
134+
with:
135+
host: ${{ secrets.DOCS_HOST }}
136+
username: docs
137+
port: ${{ secrets.DOCS_PORT }}
138+
key: ${{ secrets.DEPLOY_AUTH_KEY }}
139+
script: /var/www/docs/deploy/github-trigger.sh all ${{ steps.upload-full.outputs.artifact-id }} ${{ secrets.DOWNLOAD_TOKEN }}
140+
141+
142+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build
2+
dist
3+
venv

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
3+
4+
all: venv
5+
venv/bin/sphinx-build -j auto -b html -D language=en -d build/en/doctrees source dist/en
6+
7+
8+
venv:
9+
python -m venv venv
10+
venv/bin/pip3 install -r requirements.txt
11+

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Nitrokey Documentation
2+
3+
4+
5+
### Local build
6+
7+
Be sure to have a recent python installed, then just:
8+
9+
```
10+
make
11+
```
1.1 MB
Binary file not shown.

0 commit comments

Comments
 (0)