From 1943d612b3f9de559676a7e9adf71eefd49564a7 Mon Sep 17 00:00:00 2001 From: Viacheslav Bocharov Date: Wed, 14 Feb 2024 09:20:06 +0300 Subject: [PATCH] JH: update translations cache --- .github/workflows/jh-builder.yml | 54 +++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/.github/workflows/jh-builder.yml b/.github/workflows/jh-builder.yml index de855a71c4711f..43c8f1d6630660 100644 --- a/.github/workflows/jh-builder.yml +++ b/.github/workflows/jh-builder.yml @@ -94,10 +94,55 @@ jobs: twine upload dist/* --skip-existing + cache_translations: + name: Cache translations + if: github.repository_owner == 'jethub-homeassistant' + needs: init + runs-on: ${{ vars.RUNNER }} + permissions: + contents: read + packages: write + id-token: write + steps: + - name: Checkout the repository + uses: actions/checkout@v4.1.1 + + - name: update build.yaml + run: cp -f build-jethub.yaml build.yaml + + - name: create dir for translations + run: | + mkdir -p build/translations-download + + - name: Restore cache translation files + id: cache-translations + uses: actions/cache/restore@v4 + with: + path: build/translations-download/ + key: core-${{ github.sha }}-translations + + - name: Check cache restore result + run: | + echo ${{ steps.cache-translations.outputs.cache-hit }} + + - name: Download Translations + if: steps.cache-translations.outputs.cache-hit != 'true' + uses: transifex/cli-action@v2 + with: + token: ${{ secrets.TX_TOKEN }} + args: pull -s -t -a + + - name: Save translation files into cache + if: steps.cache-translations.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: build/translations-download/ + key: core-${{ github.sha }}-translations + build_base: name: Build ${{ matrix.arch }} base core image if: github.repository_owner == 'jethub-homeassistant' - needs: init + needs: [ "init", "cache_translations" ] runs-on: ${{ vars.RUNNER }} permissions: contents: read @@ -215,14 +260,14 @@ jobs: echo ${{ steps.cache-translations.outputs.cache-hit }} - name: Download Translations - if: ${{ steps.cache-translations.outputs.cache-hit }} == 'false' + if: steps.cache-translations.outputs.cache-hit != 'true' uses: transifex/cli-action@v2 with: token: ${{ secrets.TX_TOKEN }} args: pull -s -t -a - name: Save translation files into cache - if: ${{ steps.cache-translations.outputs.cache-hit }} == 'false' + if: steps.cache-translations.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: path: build/translations-download/ @@ -258,11 +303,12 @@ jobs: run: find ./homeassistant/components/*/translations -name "*.json" | tar zcvf translations.tar.gz -T - - name: Upload translations - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: translations path: translations.tar.gz if-no-files-found: error + overwrite: true build_machine: name: Build ${{ matrix.machine }} machine core image