From efa803aab68d7990a8b1a83cf7d4decc04d02c49 Mon Sep 17 00:00:00 2001 From: Jason Dove Date: Sun, 23 Jan 2022 14:10:57 -0600 Subject: [PATCH] split mac artifacts job --- .github/workflows/artifacts.yml | 128 +++++++++++++++++++++++--------- 1 file changed, 94 insertions(+), 34 deletions(-) diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml index 66ac8e5f6..180bb819a 100644 --- a/.github/workflows/artifacts.yml +++ b/.github/workflows/artifacts.yml @@ -26,22 +26,13 @@ on: gh_token: required: true jobs: - build_and_upload: - name: Build & Upload Artifacts + build_and_upload_mac: + name: Build & Upload Mac Artifacts runs-on: ${{ matrix.os }} if: contains(github.event.head_commit.message, '[no build]') == false strategy: matrix: include: - - os: ubuntu-latest - kind: linux - target: linux-x64 - - os: ubuntu-latest - kind: linux - target: linux-arm - - os: windows-latest - kind: windows - target: win-x64 - os: macos-latest kind: macOS target: osx-x64 @@ -67,11 +58,93 @@ jobs: - name: Import Code-Signing Certificates uses: Apple-Actions/import-codesign-certs@v1 - if: matrix.kind == 'macOS' with: p12-file-base64: ${{ secrets.apple_developer_certificate_p12_base64 }} p12-password: ${{ secrets.apple_developer_certificate_password }} + - name: Calculate Release Name + shell: bash + run: | + release_name="ErsatzTV-${{ inputs.release_version }}-${{ matrix.target }}" + echo "RELEASE_NAME=${release_name}" >> $GITHUB_ENV + + - name: Build + shell: bash + run: | + dotnet msbuild ErsatzTV/ErsatzTV.csproj -t:BundleApp -p:RuntimeIdentifier="${{ matrix.target }}" -p:CFBundleVersion="${{ inputs.info_version }}" -p:Configuration=Release -p:CFBundleShortVersionString="${{ inputs.info_version }}" -p:InformationalVersion="${{ inputs.release_version }}-${{ matrix.target }}" -p:PublishDir=$(pwd)/release + cp scripts/macOS/launcher.sh release/ErsatzTV.app/Contents/MacOS/ + env: + AC_USERNAME: ${{ secrets.ac_username }} + AC_PASSWORD: ${{ secrets.ac_password }} + + - name: Sign + shell: bash + run: scripts/macOS/sign.sh + + - name: Notarize + shell: bash + run: | + brew tap mitchellh/gon + brew install mitchellh/gon/gon + gon -log-level=debug -log-json ./gon.json + + - name: Cleanup + shell: bash + run: | + mv release/ErsatzTV.dmg "${{ env.RELEASE_NAME }}.dmg" + rm -r release + + - name: Delete old release assets + uses: mknejp/delete-release-assets@v1 + with: + token: ${{ secrets.gh_token }} + tag: ${{ inputs.release_tag }} + fail-if-no-assets: false + assets: | + *${{ matrix.target }}.dmg + + - name: Publish + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ inputs.release_tag }} + files: | + ${{ env.RELEASE_NAME }}.dmg + env: + GITHUB_TOKEN: ${{ secrets.gh_token }} + build_and_upload: + name: Build & Upload Artifacts + runs-on: ${{ matrix.os }} + if: contains(github.event.head_commit.message, '[no build]') == false + strategy: + matrix: + include: + - os: ubuntu-latest + kind: linux + target: linux-x64 + - os: ubuntu-latest + kind: linux + target: linux-arm + - os: windows-latest + kind: windows + target: win-x64 + steps: + - name: Get the sources + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x + + - name: Clean + run: dotnet clean --configuration Release && dotnet nuget locals all --clear + + - name: Install dependencies + run: dotnet restore -r "${{ matrix.target}}" + - name: Build shell: bash run: | @@ -80,28 +153,17 @@ jobs: echo "RELEASE_NAME=${release_name}" >> $GITHUB_ENV # Build everything - if [ "${{ matrix.kind }}" == "macOS" ]; then - brew tap mitchellh/gon - brew install mitchellh/gon/gon - dotnet msbuild ErsatzTV/ErsatzTV.csproj -t:BundleApp -p:RuntimeIdentifier="${{ matrix.target }}" -p:CFBundleVersion="${{ inputs.info_version }}" -p:Configuration=Release -p:CFBundleShortVersionString="${{ inputs.info_version }}" -p:InformationalVersion="${{ inputs.release_version }}-${{ matrix.target }}" -p:PublishDir=$(pwd)/release - cp scripts/macOS/launcher.sh release/ErsatzTV.app/Contents/MacOS/ - scripts/macOS/sign.sh - gon -log-level=debug -log-json ./gon.json - mv release/ErsatzTV.dmg "${release_name}.dmg" - rm -r release + dotnet publish ErsatzTV/ErsatzTV.csproj --framework net6.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name" /property:InformationalVersion="${{ inputs.release_version }}-${{ matrix.target }}" /property:EnableCompressionInSingleFile=true /property:DebugType=Embedded /property:PublishSingleFile=true --self-contained true + + # Pack files + if [ "${{ matrix.kind }}" == "windows" ]; then + 7z a -tzip "${release_name}.zip" "./${release_name}/*" else - dotnet publish ErsatzTV/ErsatzTV.csproj --framework net6.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name" /property:InformationalVersion="${{ inputs.release_version }}-${{ matrix.target }}" /property:EnableCompressionInSingleFile=true /property:DebugType=Embedded /property:PublishSingleFile=true --self-contained true - - # Pack files - if [ "${{ matrix.target }}" == "win-x64" ]; then - 7z a -tzip "${release_name}.zip" "./${release_name}/*" - else - tar czvf "${release_name}.tar.gz" "$release_name" - fi - - # Delete output directory - rm -r "$release_name" + tar czvf "${release_name}.tar.gz" "$release_name" fi + + # Delete output directory + rm -r "$release_name" env: AC_USERNAME: ${{ secrets.ac_username }} AC_PASSWORD: ${{ secrets.ac_password }} @@ -115,7 +177,6 @@ jobs: assets: | *${{ matrix.target }}.zip *${{ matrix.target }}.tar.gz - *${{ matrix.target }}.dmg - name: Publish uses: softprops/action-gh-release@v1 with: @@ -124,6 +185,5 @@ jobs: files: | ${{ env.RELEASE_NAME }}.zip ${{ env.RELEASE_NAME }}.tar.gz - ${{ env.RELEASE_NAME }}.dmg env: GITHUB_TOKEN: ${{ secrets.gh_token }}