Support skip-signed portable signing (#28) #161
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: dotnet-tool | |
| on: | |
| push: | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build_release_artifacts: | |
| name: Build dotnet tool artifact (${{ matrix.name }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: linux-x64 | |
| os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| archive: psign-tool-linux-x64.zip | |
| binary: psign-tool | |
| - name: linux-arm64 | |
| os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| archive: psign-tool-linux-arm64.zip | |
| binary: psign-tool | |
| - name: windows-x64 | |
| os: windows-2022 | |
| target: x86_64-pc-windows-msvc | |
| archive: psign-tool-windows-x64.zip | |
| binary: psign-tool.exe | |
| - name: windows-arm64 | |
| os: windows-2022 | |
| target: aarch64-pc-windows-msvc | |
| archive: psign-tool-windows-arm64.zip | |
| binary: psign-tool.exe | |
| - name: macos-x64 | |
| os: macos-14 | |
| target: x86_64-apple-darwin | |
| archive: psign-tool-macos-x64.zip | |
| binary: psign-tool | |
| - name: macos-arm64 | |
| os: macos-14 | |
| target: aarch64-apple-darwin | |
| archive: psign-tool-macos-arm64.zip | |
| binary: psign-tool | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install Rust toolchain | |
| shell: pwsh | |
| run: | | |
| rustup toolchain install stable --profile minimal --target "${{ matrix.target }}" | |
| rustup default stable | |
| - name: Cache cargo artifacts | |
| uses: Swatinem/rust-cache@v2.9.1 | |
| - name: Install Linux ARM64 linker | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Configure static MSVC runtime | |
| if: contains(matrix.target, 'windows-msvc') | |
| shell: pwsh | |
| run: | | |
| "RUSTFLAGS=-C target-feature=+crt-static" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Build psign-tool | |
| shell: pwsh | |
| env: | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
| run: | | |
| $target = '${{ matrix.target }}' | |
| $cargoArgs = @( | |
| 'build', | |
| '--locked', | |
| '--release', | |
| '-p', | |
| 'psign', | |
| '--bin', | |
| 'psign-tool', | |
| '--target', | |
| $target | |
| ) | |
| cargo @cargoArgs | |
| - name: Verify Windows version info | |
| if: contains(matrix.target, 'windows-msvc') | |
| shell: pwsh | |
| run: | | |
| ./scripts/ci/test-windows-version-info.ps1 ` | |
| -Path "target/${{ matrix.target }}/release/${{ matrix.binary }}" | |
| - name: Package artifact | |
| shell: pwsh | |
| env: | |
| TARGET: ${{ matrix.target }} | |
| BIN_NAME: ${{ matrix.binary }} | |
| ARCHIVE_NAME: ${{ matrix.archive }} | |
| run: | | |
| $target = $env:TARGET | |
| $binName = $env:BIN_NAME | |
| $archiveName = $env:ARCHIVE_NAME | |
| $binaryPath = [System.IO.Path]::Combine("target", $target, "release", $binName) | |
| if (-not (Test-Path -Path $binaryPath)) { | |
| throw "Binary not found: $binaryPath" | |
| } | |
| if (Test-Path -Path $archiveName) { | |
| Remove-Item -Path $archiveName -Force | |
| } | |
| Add-Type -AssemblyName System.IO.Compression.FileSystem | |
| $archive = [System.IO.Compression.ZipFile]::Open($archiveName, [System.IO.Compression.ZipArchiveMode]::Create) | |
| try { | |
| [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile( | |
| $archive, | |
| $binaryPath, | |
| $binName, | |
| [System.IO.Compression.CompressionLevel]::Optimal | |
| ) | Out-Null | |
| } | |
| finally { | |
| $archive.Dispose() | |
| } | |
| Write-Host "Created $archiveName" | |
| - name: Upload packaged artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.archive }} | |
| path: ${{ matrix.archive }} | |
| if-no-files-found: error | |
| pack_dotnet_tool_dry_run: | |
| name: Dry-run dotnet tool pack | |
| runs-on: ubuntu-latest | |
| needs: build_release_artifacts | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Download native artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: dist | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Import binaries and pack dotnet tool (dry-run) | |
| shell: pwsh | |
| env: | |
| CI_RUN_NUMBER: ${{ github.run_number }} | |
| run: | | |
| $version = "0.0.0-ci.$env:CI_RUN_NUMBER" | |
| $stagingRoot = Join-Path $PWD "nuget/staging" | |
| ./nuget/pack-psign-dotnet-tool.ps1 ` | |
| -Version $version ` | |
| -ArtifactsRoot "dist" ` | |
| -StagingRoot $stagingRoot ` | |
| -OutputDir "dist/nuget" | |
| - name: Smoke-test dotnet tool package install | |
| shell: pwsh | |
| env: | |
| CI_RUN_NUMBER: ${{ github.run_number }} | |
| run: | | |
| ./nuget/scripts/Test-PsignDotnetToolPackage.ps1 ` | |
| -Version "0.0.0-ci.$env:CI_RUN_NUMBER" ` | |
| -PackageDir "dist/nuget" ` | |
| -ToolPath (Join-Path $env:RUNNER_TEMP "psign-tool-package-smoke") | |
| - name: Upload dry-run dotnet tool artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: devolutions-psign-tool-nupkg-dry-run | |
| path: dist/nuget/Devolutions.Psign.Tool*.nupkg | |
| if-no-files-found: error |