Release #1
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: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: Validate release flow without publishing | |
| required: true | |
| default: false | |
| type: boolean | |
| publish_cargo: | |
| description: Publish Rust crates before NuGet | |
| required: true | |
| default: true | |
| type: boolean | |
| publish_nuget: | |
| description: Publish the Dhara.Storage NuGet package after Cargo release | |
| required: true | |
| default: true | |
| type: boolean | |
| env: | |
| CARGO_TERM_COLOR: always | |
| DOTNET_CLI_HOME: ${{ github.workspace }}\.dotnet | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| release: | |
| name: release (windows) | |
| runs-on: windows-latest | |
| if: github.ref == 'refs/heads/main' | |
| environment: nuget-production | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| lfs: true | |
| persist-credentials: true | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| - name: Add Rust targets | |
| run: rustup target add aarch64-pc-windows-msvc | |
| - name: Install .NET SDK | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Cache Cargo dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install cargo-release | |
| run: cargo install cargo-release --version 1.1.2 --locked | |
| - name: Configure git author | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Run release | |
| shell: pwsh | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| run: | | |
| $vsInstall = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 Microsoft.VisualStudio.Component.VC.Tools.ARM64 -property installationPath | |
| if ([string]::IsNullOrWhiteSpace($vsInstall)) { | |
| throw "Visual Studio with x64 and ARM64 MSVC build tools was not found." | |
| } | |
| $vcvars = Join-Path $vsInstall "VC\Auxiliary\Build\vcvarsall.bat" | |
| $arguments = @("run", "-p", "dhara_tool", "--", "release", "run") | |
| if ("${{ inputs.dry_run }}" -eq "true") { | |
| $arguments += "--dry-run" | |
| } | |
| if ("${{ inputs.publish_cargo }}" -ne "true") { | |
| $arguments += "--skip-cargo" | |
| } | |
| if ("${{ inputs.publish_nuget }}" -ne "true") { | |
| $arguments += "--skip-nuget" | |
| } | |
| $command = "call `"$vcvars`" x64_arm64 && cargo " + ($arguments -join " ") | |
| & cmd.exe /d /c $command | |
| if ($LASTEXITCODE -ne 0) { | |
| exit $LASTEXITCODE | |
| } | |
| - name: Upload NuGet artifacts | |
| if: ${{ always() && inputs.publish_nuget }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: Dhara.Storage-package | |
| path: | | |
| .artifacts/dhara_tool/nuget/*.nupkg | |
| .artifacts/dhara_tool/nuget/*.snupkg | |
| .artifacts/dhara_tool/nuget/*.symbols.nupkg |