-
Notifications
You must be signed in to change notification settings - Fork 1
96 lines (78 loc) · 2.69 KB
/
ci.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
name: CI
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
jobs:
Build:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: 3.9
cache: pipenv
- name: Install pipenv
run: pip install pipenv
- name: Install dependencies
if: steps.setup-python.outputs.cache-hit != 'true'
run: pipenv install --deploy --dev
- name: Build gettext strings
run: pipenv run sphinx-build -b gettext source build/locale
- name: Push and Pull strings from the Crowdin
uses: crowdin/github-action@v1
if: github.ref == 'refs/heads/master'
with:
token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
upload_sources: ${{ github.event_name == 'push' }}
download_translations: true
push_translations: false
download_language: en # Temporary limit only to English
- name: Fix permissions to the locale dir
if: github.ref == 'refs/heads/master'
run: sudo chown -R $USER:$USER locale
- name: Build docs
run: pipenv run python build-multilang.py
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: build
retention-days: 7
- id: detect-diffs
name: Detect diffs
if: github.event_name == 'schedule'
run: |
git fetch origin
gh_pages_exists=$(git ls-remote --heads origin gh-pages)
if [[ -z ${gh_pages_exists} ]]; then
echo "::warning::gh_pages branch doesn't exists"
echo "should-continue=false" >> $GITHUB_OUTPUT
exit
fi
tmp_dir=$(mktemp -du)
git worktree add "$tmp_dir" origin/gh-pages
diff_detected=false
for l in locale/*; do
l=$(basename $l)
if ! diff -qbB -- "build/$l" "$tmp_dir/$l" > /dev/null; then
diff_detected=true
break
fi
done
echo "should-continue=$diff_detected" >> $GITHUB_OUTPUT
- name: Deploy to the GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master') ||
(github.event_name == 'schedule' && steps.detect-diffs.outputs.should-continue == 'true')
with:
branch: gh-pages
folder: build
single-commit: true