-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (93 loc) · 3.29 KB
/
Copy pathrelease.yml
File metadata and controls
112 lines (93 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Release
on:
workflow_dispatch:
inputs:
dry_run:
description: Validate release flow without publishing
required: true
default: false
type: boolean
publish_cargo:
description: Publish dhara_storage_dal and dhara_storage 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@v7
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: Publish DAL, runtime, and NuGet
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: |
tooling/output/nuget/*.nupkg
tooling/output/nuget/*.snupkg
tooling/output/nuget/*.symbols.nupkg