mirror of
https://github.com/OpenListTeam/OpenList-Frontend.git
synced 2026-09-20 17:11:46 +00:00
bb6299003f
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
95 lines
2.8 KiB
YAML
95 lines
2.8 KiB
YAML
name: Sync i18n files
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 12 * * *"
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "src/lang/en/**"
|
|
pull_request:
|
|
paths:
|
|
- ".github/workflows/i18n*.yml"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
sync_i18n:
|
|
name: Generate and i18n files
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout frontend codes
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: Checkout backend codes
|
|
uses: actions/checkout@v6
|
|
with:
|
|
repository: ${{ vars.SYNC_LANG_ENV_BACKEND_REPOSITORY || 'OpenListTeam/OpenList' }}
|
|
ref: main
|
|
path: backend
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: Setup go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: "1.25"
|
|
cache-dependency-path: backend/go.sum
|
|
|
|
- name: Generate and update lang files
|
|
run: |
|
|
cd backend
|
|
go run ./main.go lang --frontend-path ../
|
|
cd ..
|
|
|
|
- name: Check for changes and stage
|
|
id: verify-changed-files
|
|
run: |
|
|
cp -f ./backend/lang/*.json ./src/lang/en/ 2>/dev/null || :
|
|
if git diff --quiet HEAD -- src/lang/en/; then
|
|
echo "No changes detected in src/lang/en/"
|
|
echo "changed=false" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "Changes detected in src/lang/en/"
|
|
git add src/lang/en/
|
|
echo "changed=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Import GPG key
|
|
if: steps.verify-changed-files.outputs.changed == 'true'
|
|
uses: crazy-max/ghaction-import-gpg@v7
|
|
with:
|
|
gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
|
|
passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }}
|
|
git_config_global: true
|
|
git_user_signingkey: true
|
|
git_commit_gpgsign: true
|
|
git_tag_gpgsign: true
|
|
|
|
- name: Setup CI Bot
|
|
if: steps.verify-changed-files.outputs.changed == 'true'
|
|
run: |
|
|
git config --global user.name "${{ secrets.BOT_USERNAME }}"
|
|
git config --global user.email "${{ secrets.BOT_USEREMAIL }}"
|
|
|
|
- name: Commit the changes
|
|
if: steps.verify-changed-files.outputs.changed == 'true'
|
|
run: |
|
|
git commit -S -m "chore: auto update i18n file"
|
|
# Skip pushing if triggered by a pull request
|
|
if [ "${{ github.event_name }}" != "pull_request" ]; then
|
|
git push
|
|
fi
|
|
|
|
- name: Sync to Crowdin
|
|
if: ${{ steps.verify-changed-files.outputs.changed == 'true' || github.event_name == 'push' }}
|
|
uses: ./.github/actions/sync_to_crowdin
|
|
with:
|
|
crowdin_project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
|
|
crowdin_personal_token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
|
|
|
permissions:
|
|
contents: write
|