build: move update-translations in script #1
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
on: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'crates/rnote-ui/po/LINGUAS' | |
- 'crates/rnote-ui/po/zh_Hans.po' | |
- 'crates/rnote-ui/po/zh_Hant.po' | |
workflow_dispatch: | |
workflow_call: | |
name: Update Translations | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
i18n_zh_Hans2zh_Hant: | |
name: zh_Hans -> zh_Hant | |
runs-on: ubuntu-22.04 | |
container: fedora:39 | |
permissions: | |
contents: write # needed for pushing the changes | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo dnf install --refresh -y git opencc-tools | |
- name: Setup repository | |
run: | | |
git clone -b ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} \ | |
${{ github.server_url }}/${{ github.repository }} . | |
git config --global --add safe.directory "$(pwd)" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
- name: Update translations | |
run: | | |
bash ./build-aux/update-translations.sh | |
- name: Commit changes | |
id: commit-changes | |
run: | | |
echo -e "i18n: Update traditional Chinese translation\nreferenced issue: #220" \ | |
| git commit -a -F - || export failure=$? | |
if [ -z $failure ]; then | |
echo "status=true" >> $GITHUB_OUTPUT | |
elif [ $failure = '1' ]; then | |
echo 'No commit made, skip push.' | |
echo "status=false" >> $GITHUB_OUTPUT | |
else | |
exit $failure | |
fi | |
- name: Push changes | |
if: ${{ steps.commit-changes.outputs.status == 'true' }} | |
uses: ad-m/github-push-action@v0.8.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |