mirror of
https://github.com/elyby/docs.git
synced 2024-12-02 03:30:50 +05:30
Add schedule to update translations of the documentation
This commit is contained in:
parent
ccc10f1850
commit
cafd31f43e
52
.github/workflows/ci.yml
vendored
52
.github/workflows/ci.yml
vendored
@ -1,8 +1,10 @@
|
|||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
- push
|
push:
|
||||||
- pull_request
|
pull_request:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 2 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build:
|
Build:
|
||||||
@ -36,18 +38,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Push and Pull strings from the Crowdin
|
- name: Push and Pull strings from the Crowdin
|
||||||
uses: crowdin/github-action@1.1.0
|
uses: crowdin/github-action@1.1.0
|
||||||
# TODO: remove upgrade branch after finishing upgrading process
|
if: github.ref == 'refs/heads/master'
|
||||||
if: contains(fromJson('["refs/heads/master", "refs/heads/upgrade"]'), github.ref)
|
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||||
|
|
||||||
upload_sources: true
|
upload_sources: ${{ github.event_name == 'push' }}
|
||||||
|
|
||||||
download_translations: true
|
download_translations: true
|
||||||
push_translations: false
|
push_translations: false
|
||||||
download_language: en # Temporary limit only to English
|
download_language: en # Temporary limit only to English
|
||||||
|
|
||||||
- name: Fix permissions to the locale dir
|
- name: Fix permissions to the locale dir
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
run: sudo chown -R $USER:$USER locale
|
run: sudo chown -R $USER:$USER locale
|
||||||
|
|
||||||
- name: Build docs
|
- name: Build docs
|
||||||
@ -60,25 +62,37 @@ jobs:
|
|||||||
path: build
|
path: build
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
Deploy:
|
- id: detect-diffs
|
||||||
runs-on: ubuntu-latest
|
name: Detect diffs
|
||||||
needs: Build
|
if: github.event_name == 'schedule'
|
||||||
# TODO: remove upgrade branch after finishing upgrading process
|
run: |
|
||||||
if: contains(fromJson('["refs/heads/master", "refs/heads/upgrade"]'), github.ref)
|
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 "::set-output name=should-continue::false"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
steps:
|
tmp_dir=$(mktemp -du)
|
||||||
- name: Checkout repository
|
git worktree add "$tmp_dir" origin/gh-pages
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- id: download
|
diff_detected=false
|
||||||
name: Download build artifacts
|
for l in locale/*; do
|
||||||
uses: actions/download-artifact@v2
|
l=$(basename $l)
|
||||||
with:
|
if ! diff -qbB -- "build/$l" "$tmp_dir/$l" > /dev/null; then
|
||||||
name: build
|
diff_detected=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "::set-output name=should-continue::$diff_detected"
|
||||||
|
|
||||||
- name: Deploy to the GitHub Pages
|
- name: Deploy to the GitHub Pages
|
||||||
uses: JamesIves/github-pages-deploy-action@4.1.0
|
uses: JamesIves/github-pages-deploy-action@4.1.0
|
||||||
|
if: |
|
||||||
|
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
|
||||||
|
(github.event_name == 'schedule' && steps.detect-diffs.outputs.should-continue == 'true')
|
||||||
with:
|
with:
|
||||||
branch: gh-pages
|
branch: gh-pages
|
||||||
folder: ${{ steps.download.outputs.download-path }}
|
folder: build
|
||||||
single-commit: true
|
single-commit: true
|
||||||
|
Loading…
Reference in New Issue
Block a user