Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
dotnet-version: 8.0.x

- name: Import binaries and pack dotnet tool (dry-run)
shell: pwsh
Expand All @@ -265,3 +265,47 @@ jobs:
name: devolutions-cirup-tool-nupkg-dry-run
path: dist/nuget/Devolutions.Cirup.Tool*.nupkg
if-no-files-found: error

validate_dotnet_tool_install:
name: Validate dotnet tool install (${{ matrix.sdk }})
runs-on: windows-latest
needs: build_release_artifacts
strategy:
fail-fast: false
matrix:
sdk:
- 8.0.x
- 10.0.x

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download native artifacts
uses: actions/download-artifact@v4
with:
path: dist

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.sdk }}

- name: Pack and validate dotnet tool
shell: pwsh
env:
CI_RUN_NUMBER: ${{ github.run_number }}
SDK_LABEL: ${{ matrix.sdk }}
run: |
$version = "0.0.0-ci.$env:CI_RUN_NUMBER-$($env:SDK_LABEL.Replace('.x', '').Replace('.', ''))"
$stagingRoot = Join-Path $PWD "nuget/staging"

./nuget/pack-cirup-dotnet-tool.ps1 `
-Version $version `
-ArtifactsRoot "dist" `
-StagingRoot $stagingRoot `
-OutputDir "dist/nuget"

./nuget/test-dotnet-tool-install.ps1 `
-Version $version `
-FeedDir "dist/nuget"
80 changes: 50 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ jobs:
- sign_windows
- pack_nuget
- pack_dotnet_tool
- validate_dotnet_tool_install

steps:
- name: Download platform zip artifacts
Expand Down Expand Up @@ -560,7 +561,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
dotnet-version: 8.0.x

- name: Import binaries and pack dotnet tool
shell: pwsh
Expand Down Expand Up @@ -588,13 +589,58 @@ jobs:
path: dist/nuget/Devolutions.Cirup.Tool*.nupkg
if-no-files-found: error

validate_dotnet_tool_install:
name: Validate dotnet tool install (${{ matrix.sdk }})
runs-on: windows-latest
needs:
- preflight
- pack_dotnet_tool
strategy:
fail-fast: false
matrix:
sdk:
- 8.0.x
- 10.0.x

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download dotnet tool artifact
uses: actions/download-artifact@v4
with:
name: devolutions-cirup-tool-nupkg
path: dist

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.sdk }}

- name: Validate packaged dotnet tool install
shell: pwsh
env:
RELEASE_TAG: ${{ needs.preflight.outputs.release_tag }}
run: |
$tag = $env:RELEASE_TAG
if (-not $tag.StartsWith('v')) {
throw "Release tag must start with 'v'. Actual: $tag"
}

$version = $tag.Substring(1)

./nuget/test-dotnet-tool-install.ps1 `
-Version $version `
-FeedDir "dist"

publish_nuget:
name: Publish NuGet packages
runs-on: ubuntu-latest
needs:
- preflight
- pack_nuget
- pack_dotnet_tool
- validate_dotnet_tool_install
if: needs.preflight.outputs.publish_nuget == 'true'
environment: ${{ needs.preflight.outputs.publish_env }}
permissions:
Expand Down Expand Up @@ -639,7 +685,7 @@ jobs:
if: steps.publish_mode.outputs.dry_run == 'true' || steps.publish_mode.outputs.has_login_user == 'true'
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
dotnet-version: 8.0.x

- name: NuGet login (OIDC)
if: steps.publish_mode.outputs.dry_run != 'true' && steps.publish_mode.outputs.has_login_user == 'true'
Expand All @@ -648,7 +694,7 @@ jobs:
with:
user: ${{ secrets.NUGET_BOT_USERNAME }}

- name: Publish to NuGet.org (RID first, pointer last)
- name: Publish to NuGet.org
if: steps.publish_mode.outputs.dry_run == 'true' || steps.publish_mode.outputs.has_login_user == 'true'
shell: pwsh
env:
Expand Down Expand Up @@ -689,33 +735,7 @@ jobs:
throw 'Missing Devolutions.Cirup.Tool package artifacts.'
}

$toolRidPattern = 'Devolutions\.Cirup\.Tool\.(win-x64|win-arm64|linux-x64|linux-arm64|osx-x64|osx-arm64|any)\.'
$toolRidPackages = $toolPackages | Where-Object { $_.Name -match $toolRidPattern }
$toolPointerPackages = $toolPackages | Where-Object { $_.Name -notmatch $toolRidPattern }

if (-not $toolRidPackages) {
throw 'Missing Devolutions.Cirup.Tool RID package artifacts.'
}

if (-not $toolPointerPackages) {
throw 'Missing Devolutions.Cirup.Tool pointer package artifact.'
}

foreach ($package in $toolRidPackages) {
$pushArgs = @(
'nuget', 'push', "$($package.FullName)",
'--api-key', "$apiKey",
'--source', "$env:NUGET_SOURCE",
'--skip-duplicate', '--no-symbols'
)

Write-Host "dotnet $($pushArgs -join ' ')"
if (-not $dryRun) {
& dotnet @pushArgs
}
}

foreach ($package in $toolPointerPackages) {
foreach ($package in $toolPackages) {
$pushArgs = @(
'nuget', 'push', "$($package.FullName)",
'--api-key', "$apiKey",
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ Run local end-to-end validation:
pwsh ./nuget/test-e2e.ps1
```

## Dotnet tool usage (.NET 10+)
## Dotnet tool usage (.NET SDK 8+)

`cirup` is also available as a RID-specific dotnet tool package: `Devolutions.Cirup.Tool`.
`cirup` is also available as a dotnet tool package: `Devolutions.Cirup.Tool`.

Install globally:

Expand All @@ -168,7 +168,7 @@ dotnet tool install -g Devolutions.Cirup.Tool
cirup --help
```

Run one-shot without permanent install:
Run one-shot without permanent install on .NET 10+:

```bash
dotnet tool exec Devolutions.Cirup.Tool -- --help
Expand Down
2 changes: 1 addition & 1 deletion cirup_cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cirup_cli"
version = "0.5.0"
version = "0.6.0"
authors = ["Marc-André Moreau <marcandre.moreau@gmail.com>"]
edition = "2024"

Expand Down
2 changes: 1 addition & 1 deletion cirup_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cirup_core"
version = "0.5.0"
version = "0.6.0"
authors = ["Marc-André Moreau <marcandre.moreau@gmail.com>"]
edition = "2024"

Expand Down
2 changes: 1 addition & 1 deletion nuget/Devolutions.Cirup.Build.Package.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<NoPackageAnalysis>true</NoPackageAnalysis>

<PackageId>Devolutions.Cirup.Build</PackageId>
<Version Condition="'$(Version)' == ''">0.5.0</Version>
<Version Condition="'$(Version)' == ''">0.6.0</Version>
<Authors>Devolutions</Authors>
<Description>Cross-platform cirup executable packaged for MSBuild pre-build RESX sorting.</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down
10 changes: 6 additions & 4 deletions nuget/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ Run the full local validation flow from the repository root:
./nuget/test-e2e.ps1
```

## RID-specific dotnet tool package
## Dotnet tool package

The repository also ships a separate RID-specific dotnet tool package: `Devolutions.Cirup.Tool`.
The repository also ships a separate dotnet tool package: `Devolutions.Cirup.Tool`.

- Package type: dotnet tool (command name `cirup`)
- SDK requirement: .NET 10 SDK or newer
- SDK requirement: .NET 8 SDK or newer
- Supported RIDs: `win-x64`, `win-arm64`, `linux-x64`, `linux-arm64`, `osx-x64`, `osx-arm64`
- Includes an `any` fallback package that prints a guidance message on unsupported runtimes
- Package includes the native executables for all supported RIDs and selects the right one at runtime

Install and run:

Expand All @@ -129,6 +129,8 @@ dotnet tool exec Devolutions.Cirup.Tool -- --help
dnx Devolutions.Cirup.Tool --help
```

`dotnet tool exec` and `dnx` require .NET 10 or newer.

Pack from prebuilt native artifacts (same artifact input as `Devolutions.Cirup.Build`):

```powershell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
<CirupBuildVersion Condition="'$(CirupBuildVersion)' == ''">0.5.0</CirupBuildVersion>
<CirupBuildVersion Condition="'$(CirupBuildVersion)' == ''">0.6.0</CirupBuildVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
57 changes: 57 additions & 0 deletions nuget/test-dotnet-tool-install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
param(
[Parameter(Mandatory = $true)]
[string]$Version,

[string]$FeedDir = (Join-Path $PSScriptRoot "..\dist\nuget"),

[string]$WorkRoot = (Join-Path $PSScriptRoot "..\target\tmp\dotnet-tool-install")
)

$ErrorActionPreference = "Stop"

$feedPath = Resolve-Path $FeedDir | Select-Object -ExpandProperty Path
$packageName = "Devolutions.Cirup.Tool.$Version.nupkg"
$packagePath = Join-Path $feedPath $packageName

if (-not (Test-Path -Path $packagePath -PathType Leaf)) {
throw "Expected tool package not found: $packagePath"
}

if (Test-Path -Path $WorkRoot) {
Remove-Item -Path $WorkRoot -Recurse -Force
}

$toolPath = Join-Path $WorkRoot "tools"
New-Item -Path $toolPath -ItemType Directory -Force | Out-Null

Write-Host "Using dotnet SDK $(dotnet --version)"
Write-Host "Installing $packageName from $feedPath"

dotnet tool install `
--tool-path $toolPath `
Devolutions.Cirup.Tool `
--version $Version `
--add-source $feedPath `
--ignore-failed-sources

if ($LASTEXITCODE -ne 0) {
throw "dotnet tool install failed with exit code $LASTEXITCODE"
}

$toolExecutable = if ($IsWindows) {
Join-Path $toolPath "cirup.exe"
}
else {
Join-Path $toolPath "cirup"
}

if (-not (Test-Path -Path $toolExecutable -PathType Leaf)) {
throw "Installed tool executable not found: $toolExecutable"
}

& $toolExecutable --help | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Installed tool execution failed with exit code $LASTEXITCODE"
}

Write-Host "Dotnet tool install smoke test succeeded."
2 changes: 1 addition & 1 deletion nuget/test-e2e.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
param(
[string]$Version = "0.5.0",
[string]$Version = "0.6.0",
[string]$Configuration = "Release"
)

Expand Down
Loading