From b3a9f80de8ba87bd6a6f0819ff590fb1d66e292b Mon Sep 17 00:00:00 2001 From: Ionite Date: Mon, 24 Jul 2023 15:07:33 -0400 Subject: [PATCH] release CI fixes --- .github/workflows/release.yml | 126 +++++++++++++++------------ StabilityMatrix.Avalonia.pupnet.conf | 15 +--- 2 files changed, 72 insertions(+), 69 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dda8bd13..21a2b343 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,20 +15,13 @@ on: types: [ published ] jobs: - release: - if: github.repository == 'ionite34/StabilityMatrix' - strategy: - matrix: - os: [windows-latest, ubuntu-latest] - include: - - os: windows-latest - platform-identifier: win-x64 - out-name: StabilityMatrix.exe - - os: ubuntu-latest - platform-identifier: linux-x64 - out-name: StabilityMatrix.AppImage - - runs-on: ${{ matrix.os }} + release-linux: + if: github.repository == 'ionite34/StabilityMatrix' || github.event_name == 'workflow_dispatch' + name: Release (linux-x64) + env: + platform-id: linux-x64 + out-name: StabilityMatrix.AppImage + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -37,87 +30,105 @@ jobs: id: tag_name with: tagRegex: "v(.*)" - - - name: Set Tag (win) - if: github.event_name == 'release' && matrix.os == 'windows-latest' - run: | - echo "Using tag ${{ env.GIT_TAG_NAME }}" - echo "RELEASE_VERSION=${{ env.GIT_TAG_NAME }}" >> $env:GITHUB_ENV - - name: Set Tag (linux) - if: github.event_name == 'release' && matrix.os == 'ubuntu-latest' + - name: Set Version from Tag + if: github.event_name == 'release' run: | echo "Using tag ${{ env.GIT_TAG_NAME }}" echo "RELEASE_VERSION=${{ env.GIT_TAG_NAME }}" >> $GITHUB_ENV - - name: Set Manual Version (win) - if: github.event_name == 'workflow_dispatch' && matrix.os == 'windows-latest' - run: | - echo "Using version ${{ github.event.inputs.version }}" - echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $env:GITHUB_ENV - - - name: Set Manual Version (linux) - if: github.event_name == 'workflow_dispatch' && matrix.os == 'ubuntu-latest' + - name: Set Version from manual input + if: github.event_name == 'workflow_dispatch' run: | echo "Using version ${{ github.event.inputs.version }}" echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV - name: Set up .NET 6 (for PupNet) - if: matrix.os == 'ubuntu-latest' uses: actions/setup-dotnet@v3 with: dotnet-version: '6.0.x' + + - name: Install PupNet + run: dotnet tool install --framework net6.0 -g KuiperZone.PupNet - name: Set up .NET 7 uses: actions/setup-dotnet@v3 with: dotnet-version: '7.0.x' + + - name: PupNet Build + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + run: pupnet -r linux-x64 -c Release --kind appimage --app-version $RELEASE_VERSION --clean -y - - name: Install dependencies - run: dotnet restore -r ${{ matrix.platform-identifier }} -p:EnableWindowsTargeting=true + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: StabilityMatrix + path: ./out/${{ env.out-name }} + + + release-windows: + if: github.repository == 'ionite34/StabilityMatrix' || github.event_name == 'workflow_dispatch' + name: Release (win-x64) + env: + platform-id: win-x64 + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 - - name: Install PupNet - if: matrix.os == 'ubuntu-latest' - run: dotnet tool install --framework net6.0 -g KuiperZone.PupNet + - uses: olegtarasov/get-tag@v2.1.2 + if: github.event_name == 'release' + id: tag_name + with: + tagRegex: "v(.*)" + + - name: Set Version from Tag + if: github.event_name == 'release' + run: | + echo "Using tag ${{ env.GIT_TAG_NAME }}" + echo "RELEASE_VERSION=${{ env.GIT_TAG_NAME }}" >> $env:GITHUB_ENV + + - name: Set Version from manual input + if: github.event_name == 'workflow_dispatch' + run: | + echo "Using version ${{ github.event.inputs.version }}" + echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $env:GITHUB_ENV + + - name: Set up .NET 7 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '7.0.x' + + - name: Install dependencies + run: dotnet restore - name: .NET Publish - if: matrix.os == 'windows-latest' env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} run: > dotnet publish ./StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj - -o out -c Release -r ${{ matrix.platform-identifier }} + -o out -c Release -r ${{ env.platform-id }} -p:Version=$env:RELEASE_VERSION -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishTrimmed=true -p:SentryOrg=${{ secrets.SENTRY_ORG }} -p:SentryProject=${{ secrets.SENTRY_PROJECT }} -p:SentryUploadSymbols=true -p:SentryUploadSources=true - - - name: PupNet Build - if: matrix.os == 'ubuntu-latest' - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - run: pupnet -r linux-x64 -c Release --kind appimage --app-version $RELEASE_VERSION --clean -y - - name: Post Build (win) - if: matrix.os == 'windows-latest' - run: mv ./out/StabilityMatrix.Avalonia.exe ./out/${{ matrix.out-name }} - - - name: Post Build (linux) - if: matrix.os == 'ubuntu-latest' - run: mv ./out/StabilityMatrix.Avalonia.AppImage ./out/${{ matrix.out-name }} + - name: Post Build + run: mv ./out/StabilityMatrix.Avalonia.exe ./out/${{ env.out-name }} - name: Upload Artifact uses: actions/upload-artifact@v2 with: name: StabilityMatrix - path: ./out/${{ matrix.out-name }} - + path: ./out/${{ env.out-name }} + - name: Create Sentry release - if: ${{ matrix.os == 'windows-latest' && (github.event_name == 'release' || github.event.inputs.sentry-release == 'true') }} + if: ${{ github.event_name == 'release' || github.event.inputs.sentry-release == 'true' }} uses: getsentry/action-release@v1 env: - MAKE_SENTRY_RELEASE: ${{ secrets.SENTRY_PROJECT != '' }} + MAKE_SENTRY_RELEASE: ${{ secrets.SENTRY_PROJECT != '' }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_ORG: ${{ secrets.SENTRY_ORG }} SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} @@ -125,10 +136,11 @@ jobs: environment: production ignore_missing: true version: StabilityMatrix@${{ env.GIT_TAG_NAME }} - + + cleanup: name: Artifact Cleanup - needs: release + needs: [release-linux, release-windows] if: github.repository == 'ionite34/StabilityMatrix' runs-on: ubuntu-latest diff --git a/StabilityMatrix.Avalonia.pupnet.conf b/StabilityMatrix.Avalonia.pupnet.conf index 75f84764..747f4394 100644 --- a/StabilityMatrix.Avalonia.pupnet.conf +++ b/StabilityMatrix.Avalonia.pupnet.conf @@ -31,16 +31,7 @@ AppShortSummary = Package and checkpoint manager for Stable Diffusion. # (complex formatting should be avoided). The content is used by package builders where supported, # including RPM and DEB, and may optionally be used to populate the '' element in the # AppStream metadata through the use of a macro variable. -AppDescription = """ - Hello World demonstrates all the major features of building distributable packages with PupNet. - It can be built for all package kinds, including AppImage, Flatpak, DEB and RPM formats on Linux, - and as a Setup file on Windows. It provides an example of using desktop and AppStream metadata files, - as well as icons and post-publish scripts. - - On execution, the Hello World program displays command arguments and assembly information. The assembly - version confirms that version information, provided in the deployment configuration, was successfully passed - through the build system, to the application. -""" +AppDescription = # Mandatory application license ID. This should be one of the recognised SPDX license # identifiers, such as: 'MIT', 'GPL-3.0-or-later' or 'Apache-2.0'. For a proprietary or @@ -147,7 +138,7 @@ DotnetProjectPath = StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj # '-p:DebugType=None -p:DebugSymbols=false -p:PublishSingleFile=true -p:PublishReadyToRun=true # -p:PublishTrimmed=true -p:TrimMode=link'. Note. This value may use macro variables. Use 'pupnet --help macro' # for reference. See: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish -DotnetPublishArgs = -p:Version=${APP_VERSION} -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None -p:DebugSymbols=false -p:PublishTrimmed=true +DotnetPublishArgs = -p:Version=${APP_VERSION} --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None -p:DebugSymbols=false -p:PublishTrimmed=true # Post-publish (or standalone build) command on Linux (ignored on Windows). It is called after dotnet # publish, but before the final output is built. This could, for example, be a script which copies @@ -172,7 +163,7 @@ DotnetPostPublishOnWindows = # used not only to specify the base output filename, but to identify the application in DEB and RPM # packages. You may wish, therefore, to ensure that the value represents a unique name. Naming # requirements are strict and must contain only alpha-numeric and '-', '+' and '.' characters. -PackageName = StabilityMatrix.Avalonia +PackageName = StabilityMatrix # Output directory, or subdirectory relative to this file. It will be created if it does not exist and # will contain the final deploy output files. If empty, it defaults to the location of this file.