From 787326948bdf292d8de34905967de52fae683b3d Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Thu, 19 Oct 2023 09:51:31 +0900 Subject: [PATCH] chore: making actions more efficient --- .github/workflows/build.yml | 75 +++++++++++++++++++------------------ package.json | 4 +- 2 files changed, 40 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 76c67631..948e4a52 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,6 +42,44 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile + # Only build without release if it is a fork + - name: Build on Mac + if: startsWith(matrix.os, 'macOS') && (github.repository == 'th-ch/youtube-music' && github.event_name == 'pull_request') + run: | + pnpm build:mac + + - name: Build on Linux + if: startsWith(matrix.os, 'ubuntu') && (github.repository == 'th-ch/youtube-music' && github.event_name == 'pull_request') + run: | + pnpm build:linux + + - name: Build on Windows + if: startsWith(matrix.os, 'windows') && (github.repository == 'th-ch/youtube-music' && github.event_name == 'pull_request') + run: | + pnpm build:win + + # Build and release if it's the main repository and is not pull-request + - name: Build and release on Mac + if: startsWith(matrix.os, 'macOS') && (github.repository == 'th-ch/youtube-music' && github.event_name != 'pull_request') + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + pnpm release:mac + + - name: Build and release on Linux + if: startsWith(matrix.os, 'ubuntu') && (github.repository == 'th-ch/youtube-music' && github.event_name != 'pull_request') + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + pnpm release:linux + + - name: Build and release on Windows + if: startsWith(matrix.os, 'windows') && (github.repository == 'th-ch/youtube-music' && github.event_name != 'pull_request') + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + pnpm release:win + - name: Test uses: coactions/setup-xvfb@v1 env: @@ -49,43 +87,6 @@ jobs: with: run: pnpm test:debug - # Build and release if it's the main repository - - name: Build and release on Mac - if: startsWith(matrix.os, 'macOS') && github.repository == 'th-ch/youtube-music' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - pnpm release:mac - - - name: Build and release on Linux - if: startsWith(matrix.os, 'ubuntu') && github.repository == 'th-ch/youtube-music' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - pnpm release:linux - - - name: Build and release on Windows - if: startsWith(matrix.os, 'windows') && github.repository == 'th-ch/youtube-music' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - pnpm 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: | - pnpm build:mac - - - name: Build on Linux - if: startsWith(matrix.os, 'ubuntu') && github.repository != 'th-ch/youtube-music' - run: | - pnpm build:linux - - - name: Build on Windows - if: startsWith(matrix.os, 'windows') && github.repository != 'th-ch/youtube-music' - run: | - pnpm build:win release: runs-on: ubuntu-latest diff --git a/package.json b/package.json index 6d12d993..89d16724 100644 --- a/package.json +++ b/package.json @@ -87,8 +87,8 @@ } }, "scripts": { - "test": "yarpm-pnpm run build && playwright test", - "test:debug": "yarpm-pnpm run build && cross-env DEBUG=pw:*,-pw:test:protocol playwright test", + "test": "playwright test", + "test:debug": "cross-env DEBUG=pw:*,-pw:test:protocol playwright test", "rollup:preload": "rollup -c rollup.preload.config.ts --configPlugin @rollup/plugin-typescript --bundleConfigAsCjs", "rollup:main": "rollup -c rollup.main.config.ts --configPlugin @rollup/plugin-typescript --bundleConfigAsCjs", "build": "yarpm-pnpm run rollup:preload && yarpm-pnpm run rollup:main",