update-translations #625
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: update-translations | |
on: | |
schedule: | |
- cron: "0 0 * * *" #runs at 00:00 UTC everyday | |
jobs: | |
ubuntu: | |
runs-on: ubuntu-latest | |
env: | |
SPHINXINTL_TRANSIFEX_ORGANIZATION_NAME: sphinx-doc | |
SPHINXINTL_TRANSIFEX_PROJECT_NAME: sphinx-doc | |
TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get date | |
id: get-date | |
run: | | |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")" | |
echo "::set-output name=yyyymm::$(/bin/date -u "+%Y%m")" | |
shell: bash | |
- name: cache pip | |
id: cache-pip | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cache/pip | |
~/.local/ | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ steps.get-date.outputs.yyyymm }} | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Check Python version | |
run: python --version | |
- name: Install graphviz | |
run: sudo apt-get install graphviz | |
- name: Install dependencies | |
run: | | |
git branch -a | |
git checkout master # attach this repo | |
git submodule init | |
git submodule update | |
(cd sphinx; git fetch origin; git checkout master; git reset --hard origin/master; git branch -a) | |
pip install -U pip setuptools | |
pip install -r ./requirements.txt | |
- name: Install Transifex CLI | |
run: | | |
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash | |
mv tx /usr/local/bin/tx | |
tx --version | |
- name: Update translations | |
run: sh ./locale/update.sh | |
- name: After success | |
run: | | |
git branch -a | |
git checkout master # attach this repo | |
git config --global user.email "sphinx-auto-update" | |
git config --global user.name "sphinx-auto-update" | |
git add . | |
git commit -m "[skip ci] by GHA https://github.com/${{ github.repository }}/actions/runs/${{ github.run_number }}" | |
- name: GitHub Push | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |