From a83e4d78ba12fc52b28bea2e1fcd938d23a0da91 Mon Sep 17 00:00:00 2001 From: AnhMTV Date: Wed, 28 Jun 2023 16:57:32 +0700 Subject: [PATCH] [Issue-677] Optimize build steps with caches --- .github/workflows/push-koni-dev-build.yml | 44 ++++++++++++++--------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/.github/workflows/push-koni-dev-build.yml b/.github/workflows/push-koni-dev-build.yml index 6d6fdeeed..3451de7a3 100644 --- a/.github/workflows/push-koni-dev-build.yml +++ b/.github/workflows/push-koni-dev-build.yml @@ -9,24 +9,36 @@ jobs: build_preview: name: Build Preview runs-on: mac-worker + env: + GH_PAT: ${{ secrets.GH_PAT }} + GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }} + KS_PASSWORD: ${{ secrets.KS_PASSWORD }} + NEXTCLOUD_CONFIG: ${{ secrets.NEXTCLOUD_CONFIG }} + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + COMMIT_MESSAGE: ${{ github.event.pull_request.title }} + REF_NAME: ${{ github.ref_name }} steps: - uses: actions/checkout@v3 with: fetch-depth: 0 token: ${{ secrets.GH_PAT }} - - name: Build Preview Version - env: - GH_PAT: ${{ secrets.GH_PAT }} - GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }} - KS_PASSWORD: ${{ secrets.KS_PASSWORD }} - NEXTCLOUD_CONFIG: ${{ secrets.NEXTCLOUD_CONFIG }} - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - COMMIT_MESSAGE: ${{ github.event.pull_request.title }} - REF_NAME: ${{ github.ref_name }} - run: | - yarn install --immutable | grep -v 'YN0013' - node ./scripts/autocheck.mjs - cd ./android - node ../scripts/build-android.mjs - cd ../ios - node ../scripts/build-ios.mjs + + - name: Cache Dependencies + uses: actions/cache@v2 + with: + path: ~/.cache/yarn + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install Dependencies + run: yarn install --immutable | grep -v 'YN0013' + + - name: Autocheck + run: node ./scripts/autocheck.mjs + + - name: Build Android + run: cd ./android && node ../scripts/build-android.mjs + + - name: Build iOS + run: cd ./ios && node ../scripts/build-ios.mjs \ No newline at end of file