From 7e178245fef4ceffe58725855089c0c4abfad978 Mon Sep 17 00:00:00 2001 From: kuleshov-aleksei Date: Sat, 11 Nov 2023 22:27:57 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20Update=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dotnet-desktop.yml | 48 ++++++++++++++++------------ 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index 25b3d84..17b1c60 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -22,8 +22,13 @@ jobs: env: Solution_Path: Watermarker.sln - TargetApplication: Watermarker\Watermarker.csproj - InstallerApplication: Watermarker.Installer\Watermarker.Installer.csproj + TargetApplicationProjectFile: Watermarker.csproj + InstallerApplicationProjectFile: Watermarker.Installer.csproj + TargetApplicationDirectory: Watermarker + InsatllerApplicationDirectory: Watermarker.Installer + ZipPrefix: watermarker + ZipInstaller: watermarker-installer.zip + ArtifactName: WatermarkerInstaller steps: - name: Checkout @@ -31,10 +36,6 @@ jobs: with: fetch-depth: 0 - - name: Use Nerdbank.GitVersioning to set version variables - uses: dotnet/nbgv@master - id: nbgv - # Install the .NET Core workload - name: Install .NET Core uses: actions/setup-dotnet@v3 @@ -45,13 +46,6 @@ jobs: - name: Setup MSBuild.exe uses: microsoft/setup-msbuild@v1.1 - # Update the version before build - #- name: Update manifest version - # run: | - # [xml]$manifest = get-content ".\$env:Wap_Project_Directory\Package.appxmanifest" - # $manifest.Package.Identity.Version = "${{ steps.nbgv.outputs.SimpleVersion }}.0" - # $manifest.save(".\$env:Wap_Project_Directory\Package.appxmanifest") - # Restore the application to populate the obj folder with RuntimeIdentifiers - name: Restore the application run: msbuild $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration /p:RuntimeIdentifier=$env:RuntimeIdentifier @@ -61,21 +55,33 @@ jobs: # Build main application - name: Build the main application - run: msbuild $env:TargetApplication /p:Platform=$env:TargetPlatform /p:Configuration=$env:Configuration + run: msbuild $env:TargetApplicationDirectory/$env:TargetApplicationProjectFile /p:Platform=$env:TargetPlatform /p:Configuration=$env:Configuration env: Configuration: Release TargetPlatform: ${{ matrix.targetplatform }} # Build installer - name: Build installer - run: msbuild $env:InstallerApplication /p:Platform=$env:TargetPlatform /p:Configuration=$env:Configuration + run: msbuild $env:InsatllerApplicationDirectory/$env:InstallerApplicationProjectFile /p:Platform=$env:TargetPlatform /p:Configuration=$env:Configuration env: Configuration: Release TargetPlatform: ${{ matrix.targetplatform }} - # Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact - #- name: Upload build artifacts - # uses: actions/upload-artifact@v3 - # with: - # name: MSIX Package - # path: src\${{ env.Wap_Project_Directory }}\${{ env.App_Packages_Directory }} + - name: Pack application into zip + uses: vimtor/action-zip@v1.1 + with: + files: src/$env:TargetApplicationDirectory/bin/${{ matrix.targetplatform }}/${{ matrix.configuration }}/net6.0-windows/ + dest: src/$env:InsatllerApplicationDirectory/bin/${{ matrix.targetplatform }}/${{ matrix.configuration }}/net6.0-windows/$env:ZipPrefix-${{github.ref_name}}.zip + + - name: Pack release with installer + uses: vimtor/action-zip@v1.1 + with: + files: src/$env:InsatllerApplicationDirectory/bin/${{ matrix.targetplatform }}/${{ matrix.configuration }}/net6.0-windows/ + dest: src/$env:InsatllerApplicationDirectory/bin/${{ matrix.targetplatform }}/${{ matrix.configuration }}/net6.0-windows/$env:ZipInstaller-${{github.ref_name}}.zip + + # Upload artifacts: https://github.com/marketplace/actions/upload-a-build-artifact + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{ env.ArtifactName }} + path: src/$env:InsatllerApplicationDirectory/bin/${{ matrix.targetplatform }}/${{ matrix.configuration }}/net6.0-windows/$env:ZipInstaller-${{github.ref_name}}.zip