Skip to content

Commit 425cff5

Browse files
authored
Fix fetching translations for builds
1 parent e44ade8 commit 425cff5

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

.github/workflows/build-and-release.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414
jobs:
1515
build:
1616
runs-on: ubuntu-latest
17-
if: ${{ always() }}
17+
if: ${{ always() && needs.fetch-translations.result != 'failure' }}
1818
needs: [determine-build, fetch-translations]
1919
timeout-minutes: 15
2020
strategy:
@@ -24,6 +24,7 @@ jobs:
2424
steps:
2525
- name: Checkout
2626
uses: actions/checkout@v3
27+
if: ${{ always() && needs.fetch-translations.result == 'skipped' }}
2728
with:
2829
fetch-depth: 0
2930
submodules: 'true'
@@ -80,23 +81,32 @@ jobs:
8081
fail-fast: true
8182
runs-on: ubuntu-latest
8283
needs: determine-build
83-
# Only works in MCCTeam repository, since it needs crowdin secrets.
84+
# Translations will only be fetched in the MCCTeam repository, since it needs crowdin secrets.
8485
if: ${{ github.repository == 'MCCTeam/Minecraft-Console-Client' }}
8586
timeout-minutes: 15
8687

8788
steps:
88-
- name: Cache
89-
uses: actions/cache@v3.2.4
89+
- name: Check cache
90+
uses: actions/cache/restore@v3
9091
id: cache-check
9192
with:
9293
path: ${{ github.workspace }}/*
93-
key: 'translation-${{ github.sha }}'
94+
key: "translation-${{ github.sha }}"
95+
lookup-only: true
96+
restore-keys: "translation-"
9497

98+
- name: Checkout
99+
uses: actions/checkout@v3
100+
if: steps.cache-check.outputs.cache-hit != 'true'
101+
with:
102+
fetch-depth: 0
103+
submodules: 'true'
104+
95105
- name: Download translations from crowdin
96106
uses: crowdin/[email protected]
97107
if: steps.cache-check.outputs.cache-hit != 'true'
98108
with:
99-
upload_sources: true
109+
upload_sources: false
100110
upload_translations: false
101111
download_translations: true
102112

@@ -109,10 +119,17 @@ jobs:
109119
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110120
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
111121
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_TOKEN }}
122+
123+
- name: Save cache
124+
uses: actions/cache/save@v3
125+
if: steps.cache-check.outputs.cache-hit != 'true'
126+
with:
127+
path: ${{ github.workspace }}/*
128+
key: "translation-${{ github.sha }}"
112129

113130
build-transition-version:
114131
runs-on: ubuntu-latest
115-
if: ${{ always() }}
132+
if: ${{ always() && needs.fetch-translations.result != 'failure' }}
116133
needs: [determine-build, fetch-translations]
117134
timeout-minutes: 15
118135
strategy:
@@ -123,6 +140,7 @@ jobs:
123140
steps:
124141
- name: Checkout
125142
uses: actions/checkout@v3
143+
if: ${{ always() && needs.fetch-translations.result == 'skipped' }}
126144
with:
127145
fetch-depth: 0
128146
submodules: 'true'
@@ -175,7 +193,6 @@ jobs:
175193
github_token: ${{ secrets.GITHUB_TOKEN }}
176194
mode: uploadReleaseAsset
177195
filePath: ${{ env.target-out-path }}/mcc-${{ matrix.target }}.zip
178-
# ${{ env.PROJECT }}-linux.zip
179196
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') }}
180197
tag: ${{ format('{0}-{1}', env.date, github.run_number) }}
181198

0 commit comments

Comments
 (0)