From b9aa6ffdd4de9dd56810b527caf509ef28c2b6fc Mon Sep 17 00:00:00 2001 From: TC Date: Thu, 9 Feb 2023 22:08:40 +0100 Subject: [PATCH 1/2] Only build without release if it is a fork --- .github/workflows/build.yml | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c6d384ff..b885ce89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,27 +65,44 @@ jobs: with: run: yarn test - - name: Build on Mac - if: startsWith(matrix.os, 'macOS') + # 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.GH_TOKEN }} run: | yarn run release:mac - - name: Build on Linux - if: startsWith(matrix.os, 'ubuntu') + - 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 - - name: Build on Windows - if: startsWith(matrix.os, 'windows') + - 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 + # 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 + + - name: Build on Linux + if: startsWith(matrix.os, 'ubuntu') && github.repository != 'th-ch/youtube-music' + run: | + yarn run build:linux + + - name: Build on Windows + if: startsWith(matrix.os, 'windows') && github.repository != 'th-ch/youtube-music' + run: | + yarn run build:win + release: runs-on: ubuntu-latest name: Release YouTube Music From 9ec07b5fb79884a7408654103e589bb0dbda3bab Mon Sep 17 00:00:00 2001 From: TC Date: Thu, 9 Feb 2023 22:11:26 +0100 Subject: [PATCH 2/2] Only run the release stage if it is the main repo --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b885ce89..e5c7e8a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -106,7 +106,7 @@ jobs: release: runs-on: ubuntu-latest name: Release YouTube Music - if: github.ref == 'refs/heads/master' + if: github.repository == 'th-ch/youtube-music' && github.ref == 'refs/heads/master' needs: build steps: - uses: actions/checkout@v3