Skip to content

CI

CI #158

Workflow file for this run

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