Fix fetching translations for builds

This commit is contained in:
breadbyte 2023-03-23 11:30:53 +08:00 committed by GitHub
parent e44ade8688
commit 425cff529c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,7 @@ env:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ always() }} if: ${{ always() && needs.fetch-translations.result != 'failure' }}
needs: [determine-build, fetch-translations] needs: [determine-build, fetch-translations]
timeout-minutes: 15 timeout-minutes: 15
strategy: strategy:
@ -24,6 +24,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
if: ${{ always() && needs.fetch-translations.result == 'skipped' }}
with: with:
fetch-depth: 0 fetch-depth: 0
submodules: 'true' submodules: 'true'
@ -80,23 +81,32 @@ jobs:
fail-fast: true fail-fast: true
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: determine-build needs: determine-build
# Only works in MCCTeam repository, since it needs crowdin secrets. # Translations will only be fetched in the MCCTeam repository, since it needs crowdin secrets.
if: ${{ github.repository == 'MCCTeam/Minecraft-Console-Client' }} if: ${{ github.repository == 'MCCTeam/Minecraft-Console-Client' }}
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- name: Cache - name: Check cache
uses: actions/cache@v3.2.4 uses: actions/cache/restore@v3
id: cache-check id: cache-check
with: with:
path: ${{ github.workspace }}/* path: ${{ github.workspace }}/*
key: 'translation-${{ github.sha }}' key: "translation-${{ github.sha }}"
lookup-only: true
restore-keys: "translation-"
- name: Checkout
uses: actions/checkout@v3
if: steps.cache-check.outputs.cache-hit != 'true'
with:
fetch-depth: 0
submodules: 'true'
- name: Download translations from crowdin - name: Download translations from crowdin
uses: crowdin/github-action@v1.6.0 uses: crowdin/github-action@v1.6.0
if: steps.cache-check.outputs.cache-hit != 'true' if: steps.cache-check.outputs.cache-hit != 'true'
with: with:
upload_sources: true upload_sources: false
upload_translations: false upload_translations: false
download_translations: true download_translations: true
@ -110,9 +120,16 @@ jobs:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_TOKEN }} CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_TOKEN }}
- name: Save cache
uses: actions/cache/save@v3
if: steps.cache-check.outputs.cache-hit != 'true'
with:
path: ${{ github.workspace }}/*
key: "translation-${{ github.sha }}"
build-transition-version: build-transition-version:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ always() }} if: ${{ always() && needs.fetch-translations.result != 'failure' }}
needs: [determine-build, fetch-translations] needs: [determine-build, fetch-translations]
timeout-minutes: 15 timeout-minutes: 15
strategy: strategy:
@ -123,6 +140,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
if: ${{ always() && needs.fetch-translations.result == 'skipped' }}
with: with:
fetch-depth: 0 fetch-depth: 0
submodules: 'true' submodules: 'true'
@ -175,7 +193,6 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
mode: uploadReleaseAsset mode: uploadReleaseAsset
filePath: ${{ env.target-out-path }}/mcc-${{ matrix.target }}.zip filePath: ${{ env.target-out-path }}/mcc-${{ matrix.target }}.zip
# ${{ env.PROJECT }}-linux.zip
assetName: ${{ env.PROJECT }}-${{ (contains(matrix.target, 'linux-x64') && 'linux.zip') || (contains(matrix.target, 'win-x86') && 'windows-x86.zip') || (contains(matrix.target, 'win-x64') && 'windows-x64.zip') || (contains(matrix.target, 'linux-arm64') && 'linux-arm64.zip') || (contains(matrix.target, 'osx-x64') && 'osx.zip') }} assetName: ${{ env.PROJECT }}-${{ (contains(matrix.target, 'linux-x64') && 'linux.zip') || (contains(matrix.target, 'win-x86') && 'windows-x86.zip') || (contains(matrix.target, 'win-x64') && 'windows-x64.zip') || (contains(matrix.target, 'linux-arm64') && 'linux-arm64.zip') || (contains(matrix.target, 'osx-x64') && 'osx.zip') }}
tag: ${{ format('{0}-{1}', env.date, github.run_number) }} tag: ${{ format('{0}-{1}', env.date, github.run_number) }}