This repository was archived by the owner on May 21, 2026. It is now read-only.
forked from aprillz/MewUI
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (79 loc) · 2.98 KB
/
Copy pathrelease.yml
File metadata and controls
92 lines (79 loc) · 2.98 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
name: Release (NuGet + GitHub)
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
publish:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
10.0.x
- name: Compute version
id: version
shell: pwsh
run: |
$tag = "${{ github.ref_name }}"
if ($tag.StartsWith("v")) { $tag = $tag.Substring(1) }
"version=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
- name: Pack all packages
shell: pwsh
run: |
$out = Join-Path $env:GITHUB_WORKSPACE ".artifacts/nuget"
New-Item -ItemType Directory -Force -Path $out | Out-Null
$projects = @(
# Individual packages
"src\MewUI\MewUI.csproj"
"src\MewUI.Platform.Win32\MewUI.Platform.Win32.csproj"
"src\MewUI.Platform.X11\MewUI.Platform.X11.csproj"
"src\MewUI.Platform.MacOS\MewUI.Platform.MacOS.csproj"
"src\MewUI.Backend.Direct2D\MewUI.Backend.Direct2D.csproj"
"src\MewUI.Backend.Gdi\MewUI.Backend.Gdi.csproj"
"src\MewUI.Backend.MewVG.Win32\MewUI.Backend.MewVG.Win32.csproj"
"src\MewUI.Backend.MewVG.X11\MewUI.Backend.MewVG.X11.csproj"
"src\MewUI.Backend.MewVG.MacOS\MewUI.Backend.MewVG.MacOS.csproj"
# Metapackages
"meta\MewUI.Windows\MewUI.Windows.csproj"
"meta\MewUI.Linux\MewUI.Linux.csproj"
"meta\MewUI.MacOS\MewUI.MacOS.csproj"
"meta\MewUI.All\MewUI.All.csproj"
)
$failed = @()
foreach ($proj in $projects) {
Write-Host "Packing $proj ..."
dotnet pack $proj -c Release -o $out `
/p:ContinuousIntegrationBuild=true `
/p:PackageVersion="${{ steps.version.outputs.version }}"
if ($LASTEXITCODE -ne 0) { $failed += $proj }
}
if ($failed.Count -gt 0) {
Write-Error "Failed to pack: $($failed -join ', ')"
exit 1
}
- name: Push to NuGet
shell: pwsh
run: |
$packages = Get-ChildItem ".\.artifacts\nuget" -Filter "*.nupkg" -File
if ($packages.Count -eq 0) { throw "No .nupkg found under .artifacts/nuget" }
Write-Host "Pushing $($packages.Count) packages..."
foreach ($pkg in $packages) {
Write-Host " $($pkg.Name)"
dotnet nuget push $pkg.FullName `
--api-key "${{ secrets.NUGET_API_KEY }}" `
--source "https://api.nuget.org/v3/index.json" `
--skip-duplicate
}
- name: GitHub Release (auto notes)
uses: softprops/action-gh-release@v2
with:
files: .artifacts/nuget/*.nupkg
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, '-') }}