Skip to content

webhook-translate-action #31

webhook-translate-action

webhook-translate-action #31

Workflow file for this run

name: translate
on:
push:
branches:
- 'master'
paths:
- 'translate-tool/**'
- 'translation-data/**'
workflow_dispatch:
repository_dispatch:
types:
- webhook-translate-action
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: environment prepare
run: |
curl -sSL https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh | bash /dev/stdin --channel STS
- name: clone wiki
run: |
cd ..
git clone https://github.com/openluat/luatos-wiki.git
- name: translate
env:
ALIYUN_SID: ${{ secrets.ALIYUN_SID }}
ALIYUN_SKEY: ${{ secrets.ALIYUN_SKEY }}
run: |
rm -rf translated-docs/
mkdir translated-docs/
dotnet run --project translate-tool/translate-tool/ -- ../luatos-wiki/ translated-docs/ translation-data/ $ALIYUN_SID $ALIYUN_SKEY
- name: build html
run: |
sudo apt update
sudo pip3 install setuptools
sudo pip3 install -r translated-docs/requirements.txt
rm -rf docs/
sphinx-build -b html translated-docs docs -E
cd docs/
touch .nojekyll
echo "wiki.luatos.org" > "CNAME"
rm -rf .doctrees/
rm -rf _sources/
- name: commit changes
run: |
git config --global credential.helper store
git config --global user.email "bot@luatos.com"
git config --global user.name "luatos_bot"
git add .
git commit -m "ci auto translate docs"
continue-on-error: true
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}