Skip to content
Merged
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
21 changes: 14 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release

on:
push:
tags: ['v*']
tags: ['v*', 'tools-v*']

permissions:
contents: write
Expand All @@ -20,6 +20,7 @@ jobs:
8.0.x
10.0.x
- name: Validate release version
if: startsWith(github.ref_name, 'v')
shell: pwsh
run: |
$version = dotnet msbuild src/IOScene/IOScene.csproj -getProperty:Version -nologo
Expand All @@ -31,10 +32,12 @@ jobs:
- name: Extract release notes
shell: pwsh
run: |
$version = $env:GITHUB_REF_NAME.Substring(1)
$changelog = Get-Content -LiteralPath CHANGELOG.md -Encoding utf8
$toolsRelease = $env:GITHUB_REF_NAME.StartsWith('tools-v', [StringComparison]::Ordinal)
$version = if ($toolsRelease) { $env:GITHUB_REF_NAME.Substring(7) } else { $env:GITHUB_REF_NAME.Substring(1) }
$changelogPath = if ($toolsRelease) { 'docs/tools-changelog.md' } else { 'CHANGELOG.md' }
$changelog = Get-Content -LiteralPath $changelogPath -Encoding utf8
$start = [array]::FindIndex($changelog, [Predicate[string]] { param($line) $line.StartsWith("## [$version]") })
if ($start -lt 0) { throw "CHANGELOG.md has no entry for $version" }
if ($start -lt 0) { throw "$changelogPath has no entry for $version" }
$notes = @()
for ($i = $start + 1; $i -lt $changelog.Count -and -not $changelog[$i].StartsWith('## ['); $i++) { $notes += $changelog[$i] }
$notes | Set-Content -LiteralPath release-notes.md -Encoding utf8
Expand All @@ -43,7 +46,12 @@ jobs:
- run: dotnet test IOScene.slnx -c Release --no-build
- name: Pack release
shell: pwsh
run: ./tools/pack-release.ps1
run: |
if ($env:GITHUB_REF_NAME.StartsWith('tools-v', [StringComparison]::Ordinal)) {
./tools/pack-release.ps1 -ToolsVersion $env:GITHUB_REF_NAME.Substring(7)
} else {
./tools/pack-release.ps1
}
- uses: actions/upload-artifact@v7
with:
name: packages
Expand All @@ -67,10 +75,9 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$version = $env:GITHUB_REF_NAME.Substring(1)
$files = @(Get-ChildItem artifacts -File | ForEach-Object { $_.FullName })
# A version with a hyphen is a prerelease.
$flags = @()
if ($version.Contains('-')) { $flags += '--prerelease' }
if ($env:GITHUB_REF_NAME -match '^(tools-)?v[^-]+-') { $flags += '--prerelease' }
gh release create $env:GITHUB_REF_NAME --title $env:GITHUB_REF_NAME --notes-file release-notes.md @flags @files
if ($LASTEXITCODE -ne 0) { throw "gh release create failed with exit code $LASTEXITCODE" }
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Do not commit a `nuget.config` that points to a local feed.

`src/IOScene.Formats` and `src/IOCoord` are optional preview projects that consume the public IOScene 0.1 API.
Their tests are in `tests/IOScene.Tools.Tests`. Packing the solution creates local preview packages.
Core release tags publish the IOScene package. The optional previews have their own release setup pending.
Core release tags publish the IOScene package. Tags with the `tools-v` prefix release the two tools packages together.

## Changing the contract

Expand Down Expand Up @@ -139,6 +139,12 @@ contains a hyphen. The release notes are the section of `CHANGELOG.md` for the v
workflow stops before it publishes anything when the tagged commit has no section for the version. The NuGet policy
must name this repository, `release.yml`, the configured NuGet profile and the `IOScene*` package pattern.

For the optional tools, set both project versions and add the matching entry in
[`docs/tools-changelog.md`](docs/tools-changelog.md). A tag such as `tools-v0.1.0-preview.1` packs
`IOScene.Formats` and `IOCoord` only. Both package IDs must have Trusted Publishing policies for this repository and
`release.yml` that allow the first publication of each package. A local release build can be verified with
`./tools/pack-release.ps1 -ToolsVersion 0.1.0-preview.1` after building the solution in Release.

IOScene targets the lowest framework that any package depending on it targets, and drops a framework last.

## Licensing contributions
Expand Down
9 changes: 9 additions & 0 deletions docs/tools-changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# IOScene tools changelog

## [0.1.0-preview.1]

- `IOScene.Formats` reads embedded GLB and OBJ geometry and writes GLB from an IOScene document.
- `IOCoord` provides measurements, triangle surface intersections, grid queries, revision comparison and BCF 2.1 export.
- Both packages use the public IOScene 0.1 API and can be installed independently.

See [Optional IOScene tools](tools.md) for supported inputs and scope.
29 changes: 23 additions & 6 deletions tools/pack-release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,35 @@
Packs release assets into artifacts: binary archive of the library, source zip, NuGet packages and SHA256SUMS.txt.
#>
param(
[string]$Output = (Join-Path $PSScriptRoot '..\artifacts')
[string]$Output = (Join-Path $PSScriptRoot '..\artifacts'),
[ValidateNotNullOrEmpty()]
[string]$ToolsVersion
)

$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest

$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path

function Invoke-DotNet {
& dotnet @args
if ($LASTEXITCODE -ne 0) { throw "dotnet $($args -join ' ') failed with exit code $LASTEXITCODE" }
}

if ($PSBoundParameters.ContainsKey('ToolsVersion')) {
$projects = @('IOScene.Formats', 'IOCoord') | ForEach-Object { Join-Path $root "src/$_/$_.csproj" }
foreach ($project in $projects) {
$projectVersion = Invoke-DotNet msbuild $project '-getProperty:Version' -nologo
if ($projectVersion.Trim() -cne $ToolsVersion) {
throw "The tools release tag must match the version of both projects: $project uses $projectVersion."
}
}
foreach ($project in $projects) {
Invoke-DotNet pack $project -c Release --no-build -o $Output
}
return
}

$props = [xml](Get-Content -LiteralPath (Join-Path $root 'Directory.Build.props') -Raw)
$versionNode = $props.SelectSingleNode('/Project/PropertyGroup/Version')
if (-not $versionNode) {
Expand All @@ -24,11 +46,6 @@ $stage = Join-Path $Output 'stage'
if (Test-Path -LiteralPath $stage) { Remove-Item -LiteralPath $stage -Recurse -Force }
New-Item -ItemType Directory -Force -Path $stage | Out-Null

function Invoke-DotNet {
& dotnet @args
if ($LASTEXITCODE -ne 0) { throw "dotnet $($args -join ' ') failed with exit code $LASTEXITCODE" }
}

function New-Zip([string]$SourceDir, [string]$ZipPath) {
if (Test-Path -LiteralPath $ZipPath) { Remove-Item -LiteralPath $ZipPath }
Compress-Archive -Path (Join-Path $SourceDir '*') -DestinationPath $ZipPath
Expand Down
Loading