mirror of
https://github.com/RPCS3/rpcs3_translations.git
synced 2026-01-31 01:35:15 +01:00
Auto-merge new translations changes instead of opening new PRs (#17)
This commit is contained in:
27
.github/workflows/crowdin.yml
vendored
27
.github/workflows/crowdin.yml
vendored
@@ -6,11 +6,10 @@ on:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: '0 1 * * 1'
|
||||
- cron: '0 1 * * 1' # Every Monday at 01:00 UTC
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
synchronize-with-crowdin:
|
||||
@@ -19,6 +18,9 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Crowdin Action
|
||||
uses: crowdin/github-action@v2
|
||||
@@ -26,12 +28,23 @@ jobs:
|
||||
upload_sources: true
|
||||
upload_translations: false
|
||||
download_translations: true
|
||||
localization_branch_name: crow
|
||||
create_pull_request: true
|
||||
pull_request_title: 'New Crowdin Translations'
|
||||
pull_request_body: 'New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)'
|
||||
pull_request_base_branch_name: 'main'
|
||||
export_only_approved: true
|
||||
localization_branch_name: main
|
||||
create_pull_request: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||
|
||||
- name: Commit and push updated translations
|
||||
run: |
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
git add translations/
|
||||
if git diff --cached --exit-code; then
|
||||
echo "No approved translation updates found."
|
||||
else
|
||||
git commit -m "New Crowdin translations by GitHub Action [skip ci]"
|
||||
git push origin main
|
||||
fi
|
||||
|
||||
45
.github/workflows/generate-qm.yml
vendored
45
.github/workflows/generate-qm.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
done
|
||||
fi
|
||||
|
||||
- name: Upload Translations
|
||||
- name: Upload Translations as Artifact
|
||||
uses: actions/upload-artifact@main
|
||||
with:
|
||||
name: RPCS3-languages
|
||||
@@ -49,6 +49,45 @@ jobs:
|
||||
run: |
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
git add qm/
|
||||
git commit -m "Automatically generated .qm files from .ts files"
|
||||
git push
|
||||
if git diff --cached --quiet; then
|
||||
echo "No changes in .qm files detected."
|
||||
echo "no_changes=true" >> $GITHUB_ENV
|
||||
else
|
||||
git commit -m "Automatically generated .qm files from .ts files"
|
||||
git push origin main
|
||||
echo "no_changes=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Package .qm files
|
||||
if: env.no_changes == 'false'
|
||||
run: |
|
||||
(cd qm && zip -r ../RPCS3-languages.zip .)
|
||||
|
||||
- name: Set release date
|
||||
run: echo "RELEASE_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
|
||||
|
||||
- name: Create Release
|
||||
if: env.no_changes == 'false'
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: release-${{ github.run_id }}-${{ github.run_number }}
|
||||
release_name: "Translation Release - ${{ env.RELEASE_DATE }}"
|
||||
body: "Automatically generated translation release for ${{ env.RELEASE_DATE }}."
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Upload .qm files to release
|
||||
if: env.no_changes == 'false'
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: RPCS3-languages.zip
|
||||
asset_name: RPCS3-languages.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
Reference in New Issue
Block a user