From c8b149281b34ae33c28de3602740c3cbbebcc3f4 Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Tue, 19 Sep 2023 22:32:37 +0900 Subject: [PATCH] fix: update GitHub Actions script --- .github/workflows/build.yml | 92 ++++++------------------------------- 1 file changed, 15 insertions(+), 77 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dcd9cd72..5378a66e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: pull_request: env: - NODE_VERSION: "16.x" + NODE_VERSION: "20.x" jobs: build: @@ -18,54 +18,23 @@ jobs: os: [ macos-latest, ubuntu-latest, windows-latest ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup NodeJS uses: actions/setup-node@v3 with: node-version: ${{ env.NODE_VERSION }} - - - name: Expose yarn config as "$GITHUB_OUTPUT" - id: yarn-config - shell: bash - run: | - echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - # Yarn rotates the downloaded cache archives, @see https://github.com/actions/setup-node/issues/325 - # Yarn cache is also reusable between arch and os. - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-download-cache - with: - path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }} - key: yarn-download-cache-${{ hashFiles('yarn.lock') }} - restore-keys: | - yarn-download-cache- - - # Invalidated on yarn.lock changes - - name: Restore yarn install state - id: yarn-install-state-cache - uses: actions/cache@v3 - with: - path: .yarn/ci-cache/ - key: ${{ runner.os }}-yarn-install-state-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }} + cache: 'npm' - name: Install dependencies - shell: bash - run: | - yarn install --immutable --inline-builds - env: - # CI optimizations. Overrides yarnrc.yml options (or their defaults) in the CI action. - YARN_ENABLE_GLOBAL_CACHE: "false" # Use local cache folder to keep downloaded archives - YARN_NM_MODE: "hardlinks-local" # Hardlinks-(local|global) reduces io / node_modules size - YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gz # Very small speedup when lock does not change + run: npm ci - name: Test uses: GabrielBB/xvfb-action@v1 env: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 with: - run: yarn test + run: npm run test # Build and release if it's the main repository - name: Build and release on Mac @@ -73,37 +42,37 @@ jobs: env: GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | - yarn run release:mac + npm run release:mac - name: Build and release on Linux if: startsWith(matrix.os, 'ubuntu') && github.repository == 'th-ch/youtube-music' env: GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | - yarn run release:linux + npm run release:linux - name: Build and release on Windows if: startsWith(matrix.os, 'windows') && github.repository == 'th-ch/youtube-music' env: GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | - yarn run release:win + npm run release:win # Only build without release if it is a fork - name: Build on Mac if: startsWith(matrix.os, 'macOS') && github.repository != 'th-ch/youtube-music' run: | - yarn run build:mac + npm run build:mac - name: Build on Linux if: startsWith(matrix.os, 'ubuntu') && github.repository != 'th-ch/youtube-music' run: | - yarn run build:linux + npm run build:linux - name: Build on Windows if: startsWith(matrix.os, 'windows') && github.repository != 'th-ch/youtube-music' run: | - yarn run build:win + npm run build:win release: runs-on: ubuntu-latest @@ -111,7 +80,7 @@ jobs: if: github.repository == 'th-ch/youtube-music' && github.ref == 'refs/heads/master' needs: build steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -119,41 +88,10 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ env.NODE_VERSION }} - - - name: Expose yarn config as "$GITHUB_OUTPUT" - id: yarn-config - shell: bash - run: | - echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - # Yarn rotates the downloaded cache archives, @see https://github.com/actions/setup-node/issues/325 - # Yarn cache is also reusable between arch and os. - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-download-cache - with: - path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }} - key: yarn-download-cache-${{ hashFiles('yarn.lock') }} - restore-keys: | - yarn-download-cache- - - # Invalidated on yarn.lock changes - - name: Restore yarn install state - id: yarn-install-state-cache - uses: actions/cache@v3 - with: - path: .yarn/ci-cache/ - key: ${{ runner.os }}-yarn-install-state-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }} + cache: 'npm' - name: Install dependencies - shell: bash - run: | - yarn install --immutable --inline-builds - env: - # CI optimizations. Overrides yarnrc.yml options (or their defaults) in the CI action. - YARN_ENABLE_GLOBAL_CACHE: "false" # Use local cache folder to keep downloaded archives - YARN_NM_MODE: "hardlinks-local" # Hardlinks-(local|global) reduces io / node_modules size - YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gz # Very small speedup when lock does not change + run: npm ci - name: Get version run: | @@ -194,7 +132,7 @@ jobs: - name: Update changelog if: ${{ env.VERSION_HASH == '' }} run: | - yarn changelog + npm run changelog - name: Commit changelog if: ${{ env.VERSION_HASH == '' }}