Skip to content

Commit a080d36

Browse files
committed
Improve package update workflow and bump Coroutines to 1.0.6
Enhances the GitHub Actions workflow to force package updates and check published versions via direct HTTP requests, improving reliability. Updates Mal.MdkScriptMixin.Coroutines to version 1.0.6 with cancellation system improvements and a more complete readme example.
1 parent 45530cb commit a080d36

3 files changed

Lines changed: 29 additions & 29 deletions

File tree

.github/workflows/build-libraries.yml

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,13 @@ jobs:
167167
168168
foreach ($packageRef in $packageRefs) {
169169
$packageName = $packageRef.Include
170-
Write-Host " Updating $packageName..."
170+
$currentVersion = $packageRef.Version
171+
Write-Host " Updating $packageName (current: $currentVersion)..."
171172
try {
172-
dotnet add "$csprojPath" package $packageName --source $sourceUrl 2>&1 | Out-Null
173+
# Remove then re-add to force update
174+
dotnet remove "$csprojPath" package $packageName 2>&1 | Out-Null
175+
$addOutput = dotnet add "$csprojPath" package $packageName --source $sourceUrl 2>&1
176+
Write-Host " $addOutput"
173177
if ($LASTEXITCODE -eq 0) {
174178
Write-Host " Updated $packageName" -ForegroundColor Green
175179
}
@@ -220,35 +224,28 @@ jobs:
220224
$shouldBuild = $true
221225
222226
try {
223-
$searchOutput = dotnet nuget search $packageName --source $sourceUrl --format json 2>&1
224-
if ($LASTEXITCODE -eq 0 -and $searchOutput -match '^\s*\{') {
225-
$nugetVersions = $searchOutput | ConvertFrom-Json
226-
227-
if ($nugetVersions.searchResult -and $nugetVersions.searchResult.Count -gt 0) {
228-
$existingPackage = $nugetVersions.searchResult | Where-Object { $_.packages.id -eq $packageName } | Select-Object -First 1
229-
if ($existingPackage -and $existingPackage.packages -and $existingPackage.packages.Count -gt 0) {
230-
$publishedVersion = $existingPackage.packages[0].version
231-
Write-Host "Published version: $publishedVersion"
232-
233-
if ($localVersion -eq $publishedVersion) {
234-
Write-Host "Version $localVersion already published - skipping" -ForegroundColor Yellow
235-
$skippedPackages += $package
236-
$shouldBuild = $false
237-
} elseif ([version]$localVersion -le [version]$publishedVersion) {
238-
Write-Host "Local version $localVersion is not higher than published $publishedVersion - skipping" -ForegroundColor Yellow
239-
$skippedPackages += $package
240-
$shouldBuild = $false
241-
}
242-
}
243-
} else {
244-
Write-Host "No published version found - will build"
245-
}
227+
# Try to download package metadata directly from GitHub Packages
228+
$headers = @{
229+
"Authorization" = "Bearer $env:GITHUB_TOKEN"
230+
}
231+
$packageUrl = "https://nuget.pkg.github.com/malforge/download/$packageName/$localVersion/$packageName.$localVersion.nupkg"
232+
233+
Write-Host "Checking if version $localVersion exists..."
234+
$response = Invoke-WebRequest -Uri $packageUrl -Method Head -Headers $headers -ErrorAction SilentlyContinue
235+
236+
if ($response.StatusCode -eq 200) {
237+
Write-Host "Version $localVersion already exists - skipping" -ForegroundColor Yellow
238+
$skippedPackages += $package
239+
$shouldBuild = $false
246240
} else {
247-
Write-Host "Could not query NuGet feed (may not exist yet) - will build"
241+
Write-Host "Version $localVersion not found - will build"
248242
}
249243
} catch {
250-
Write-Host "Could not query NuGet feed: $_" -ForegroundColor Yellow
251-
Write-Host "Will build package anyway"
244+
if ($_.Exception.Response.StatusCode -eq 404) {
245+
Write-Host "Version $localVersion not found - will build"
246+
} else {
247+
Write-Host "Could not check version (error: $($_.Exception.Message)) - will build anyway"
248+
}
252249
}
253250
254251
if (-not $shouldBuild) {

libraries/Mal.MdkScriptMixin.Coroutines/Mal.MdkScriptMixin.Coroutines/_releasenotes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
- 1.0.6
2+
Cancellation system improvements: version-based cancellation, removed Reset() method
3+
Improved readme with complete airlock controller example
14
- 1.0.5
25
Actually fixed packageType issue (rebuilt with updated packager tool 1.0.10)
36
- 1.0.4
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.5
1+
1.0.6

0 commit comments

Comments
 (0)