diff --git a/.github/build/action.yml b/.github/build/action.yml index 18ff3b2..c31303c 100644 --- a/.github/build/action.yml +++ b/.github/build/action.yml @@ -8,40 +8,46 @@ inputs: configuration: description: 'Build configuration: Debug or Release' required: true - type: string + flavor: - description: 'Build flavor: Installer or Portable' - required: true - type: string + description: 'Build flavor: Installer or Portable' + required: true + solution_name: + description: Solution file name required: false default: PasteIntoFile.sln + project_directory: + description: Project directory required: false default: PasteIntoFile + build_options: - description: 'Additional options passed to msbuild' + description: Additional options passed to MSBuild required: false default: '' - type: string + artifact: - description: 'Name of build artifact to upload' + description: Name of build artifact to upload required: false default: '' - type: string + outputs: path: - description: 'Build output path' + description: Build output path value: ${{ steps.build.outputs.path }} + version: - description: 'Program version' + description: Program version value: ${{ steps.build.outputs.version }} + artifact-id: - description: 'Build output artifact ID' + description: Build output artifact ID value: ${{ steps.upload.outputs.artifact-id }} runs: - using: 'composite' + using: composite steps: ## Install the .NET Core workload ## This is not required since the windows-2025 runner comes with pre-installed .NET Framework @@ -50,26 +56,29 @@ runs: # with: # dotnet-version: 5.0.x - # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild - - name: Setup MSBuild.exe - uses: microsoft/setup-msbuild@v2 + # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v3 # Build the app (after restoring dependencies) - name: Build id: build - run: | - msbuild /r /p:Configuration=${{ inputs.configuration }} /p:Flavor=${{ inputs.flavor }} ${{ inputs.build_options }} - copy LICENSE ${{ inputs.project_directory }}\bin\${{ inputs.configuration }} - echo "path=${{ inputs.project_directory }}\bin\${{ inputs.configuration }}" >> $env:GITHUB_OUTPUT - $VERSION=(Get-Item -Path ${{ inputs.project_directory }}\bin\${{ inputs.configuration }}\*.exe).VersionInfo.ProductVersion - echo "version=$VERSION" >> $env:GITHUB_OUTPUT shell: pwsh + run: | + msbuild "${{ inputs.solution_name }}" /restore /p:Configuration=${{ inputs.configuration }} /p:Flavor=${{ inputs.flavor }} ${{ inputs.build_options }} + $outputPath = "${{ inputs.project_directory }}\bin\${{ inputs.configuration }}" + Copy-Item -LiteralPath LICENSE -Destination $outputPath + $exe = Get-ChildItem -LiteralPath $outputPath -Filter '*.exe' | Select-Object -First 1 + if (-not $exe) { throw "No executable found in $outputPath" } + $version = $exe.VersionInfo.ProductVersion + Add-Content -Path $env:GITHUB_OUTPUT -Value "path=$outputPath" + Add-Content -Path $env:GITHUB_OUTPUT -Value "version=$version" + # Upload build artifacts if requested - name: Upload build artifacts id: upload if: ${{ inputs.artifact != '' }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: ${{ inputs.artifact }} path: ${{ steps.build.outputs.path }} - diff --git a/.github/workflows/dotnet-release.yml b/.github/workflows/dotnet-release.yml index 396e049..4d8fd23 100644 --- a/.github/workflows/dotnet-release.yml +++ b/.github/workflows/dotnet-release.yml @@ -11,7 +11,8 @@ jobs: portable: runs-on: windows-2025 steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v7 - uses: ./.github/build id: build @@ -24,17 +25,15 @@ jobs: run: Compress-Archive -Path ${{steps.build.outputs.path}}/* -Destination release_artifact_portable_unsigned.zip - name: Upload release artifact - uses: actions/upload-release-asset@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: release_artifact_portable_unsigned.zip - asset_name: PasteIntoFile_${{ github.event.release.tag_name }}_portable_unsigned.zip - asset_content_type: application/zip + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + $asset = "PasteIntoFile_${{ github.event.release.tag_name }}_portable_unsigned.zip" + Copy-Item release_artifact_portable_unsigned.zip $asset + gh release upload "${{ github.event.release.tag_name }}" $asset --clobber - name: Sign with Signpath - uses: signpath/github-action-submit-signing-request@v1.1 + uses: signpath/github-action-submit-signing-request@v2 with: api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' organization-id: '030bee06-17be-4a2a-a788-9efdbd14a889' @@ -51,20 +50,18 @@ jobs: run: Compress-Archive -Path signing_result/* -Destination release_artifact_portable_signed.zip - name: Upload signed release artifact - uses: actions/upload-release-asset@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: release_artifact_portable_signed.zip - asset_name: PasteIntoFile_${{ github.event.release.tag_name }}_portable_signed.zip - asset_content_type: application/zip + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + $asset = "PasteIntoFile_${{ github.event.release.tag_name }}_portable_signed.zip" + Copy-Item release_artifact_portable_signed.zip $asset + gh release upload "${{ github.event.release.tag_name }}" $asset --clobber installer: runs-on: windows-2025 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Build program executable id: build @@ -80,30 +77,27 @@ jobs: - name: Build MSI file with WiX toolchain run: | cd Installer - heat dir ../${{steps.build.outputs.path}} -dr INSTALLFOLDER -ag -cg ReleaseFragment -ke -srd -sfrag -nologo -pog:Binaries -pog:Documents -pog: Satellites -pog:Sources -pog:Content -t releaseFiles.xslt -out releaseFiles.wxs + heat dir ../${{steps.build.outputs.path}} -dr INSTALLFOLDER -ag -cg ReleaseFragment -ke -srd -sfrag -nologo -pog:Binaries -pog:Documents -pog:Satellites -pog:Sources -pog:Content -t releaseFiles.xslt -out releaseFiles.wxs candle releaseFiles.wxs candle PasteIntoFile.wxs light -b ../${{steps.build.outputs.path}} releaseFiles.wixobj PasteIntoFile.wixobj -ext WixNetFxExtension -out Installer.msi - name: Upload release artifact - uses: actions/upload-release-asset@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: Installer/Installer.msi - asset_name: PasteIntoFile_${{ github.event.release.tag_name }}_installer_unsigned.msi - asset_content_type: application/msi - + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + $asset = "PasteIntoFile_${{ github.event.release.tag_name }}_installer_unsigned.msi" + Copy-Item Installer/Installer.msi $asset + gh release upload "${{ github.event.release.tag_name }}" $asset --clobber - name: Upload artifact for signing id: upload - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: path: Installer/Installer.msi - name: Sign with Signpath - uses: signpath/github-action-submit-signing-request@v1.1 + uses: signpath/github-action-submit-signing-request@v2 with: api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' organization-id: '030bee06-17be-4a2a-a788-9efdbd14a889' @@ -117,12 +111,10 @@ jobs: output-artifact-directory: 'signing_result' - name: Upload signed release artifact - uses: actions/upload-release-asset@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: signing_result/Installer.msi - asset_name: PasteIntoFile_${{ github.event.release.tag_name }}_installer_signed.msi - asset_content_type: application/msi + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + $asset = "PasteIntoFile_${{ github.event.release.tag_name }}_installer_signed.msi" + Copy-Item signing_result/Installer.msi $asset + gh release upload "${{ github.event.release.tag_name }}" $asset --clobber