From dc39edb23c11be3eef50bb777a3731dafea3f7a6 Mon Sep 17 00:00:00 2001 From: PatTheMav Date: Mon, 27 Mar 2023 00:42:38 +0200 Subject: [PATCH] CI: Prevent build artifact creation for macOS without pushed tag Pushes to master will use faster Ninja builds on macOS, which cannot generate macOS app bundles anymore. Thus packaging will only work with PR pushes (and the "Seeking Testers" label set) or upon pushing a release tag to the master branch. --- .github/workflows/main.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index edff125b7..80f90e5ff 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -156,14 +156,22 @@ jobs: fi - name: 'Create build artifact' - if: ${{ success() && fromJSON(needs.config.outputs.create_artifacts) }} + if: ${{ fromJSON(needs.config.outputs.create_artifacts) }} run: | - CI/macos/03_package_obs.sh --codesign --architecture "${{ matrix.arch }}" - ARTIFACT_NAME=$(basename $(/usr/bin/find build_${{ matrix.arch }} -type f -name "obs-studio-*.dmg" -depth 1 | head -1)) - echo "FILE_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV + : ${PACKAGE:=} + case "${GITHUB_EVENT_NAME}" in + push) if [[ ${GITHUB_REF_NAME} =~ [0-9]+.[0-9]+.[0-9]+(-(rc|beta).+)? ]]; then PACKAGE=1; fi ;; + pull_request) PACKAGE=1 ;; + esac + + if [[ "${PACKAGE}" ]]; then + CI/macos/03_package_obs.sh --codesign --architecture "${{ matrix.arch }}" + ARTIFACT_NAME=$(basename $(/usr/bin/find build_${{ matrix.arch }} -type f -name "obs-studio-*.dmg" -depth 1 | head -1)) + echo "FILE_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV + fi - name: 'Upload build Artifact' - if: ${{ success() && fromJSON(needs.config.outputs.create_artifacts) }} + if: ${{ fromJSON(needs.config.outputs.create_artifacts) && env.FILE_NAME != '' }} uses: actions/upload-artifact@v3 with: name: 'obs-studio-macos-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}'