-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (75 loc) · 2.75 KB
/
Copy pathrelease.yml
File metadata and controls
87 lines (75 loc) · 2.75 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
name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
release:
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"
- name: Resolve release version
id: version
shell: pwsh
run: |
$tag = "${{ github.ref_name }}"
$semver = $tag -replace '^v', ''
"tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
"semver=$semver" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
"zip_name=Operon-$tag-portable-win-x64.zip" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
- name: Clean publish output
shell: pwsh
run: |
if (Test-Path ./publish) {
Remove-Item ./publish -Recurse -Force
}
New-Item -ItemType Directory -Path ./publish | Out-Null
- name: Restore dependencies
run: dotnet restore .\Operon\Operon.csproj -r win-x64
- name: Publish portable EXE (win-x64)
shell: pwsh
run: |
dotnet publish .\Operon\Operon.csproj `
-c Release `
-r win-x64 `
--self-contained true `
--no-restore `
/p:PublishSingleFile=true `
/p:IncludeNativeLibrariesForSelfExtract=true `
/p:DebugType=None `
/p:DebugSymbols=false `
/p:Version=${{ steps.version.outputs.semver }} `
/p:AssemblyVersion=${{ steps.version.outputs.semver }} `
/p:FileVersion=${{ steps.version.outputs.semver }} `
-o .\publish
- name: Verify publish output
shell: pwsh
run: |
$files = Get-ChildItem .\publish -File
if ($files.Count -ne 1 -or $files[0].Name -ne 'Operon.exe') {
Write-Error "Expected a single Operon.exe in publish output, found: $($files.Name -join ', ')"
}
Write-Host "Published: $($files[0].FullName) ($([math]::Round($files[0].Length / 1MB, 2)) MB)"
- name: Create release ZIP
shell: pwsh
run: |
$zip = "${{ steps.version.outputs.zip_name }}"
if (Test-Path $zip) {
Remove-Item $zip -Force
}
Compress-Archive -Path .\publish\Operon.exe -DestinationPath $zip -CompressionLevel Optimal
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: Operon ${{ steps.version.outputs.tag }}
generate_release_notes: true
fail_on_unmatched_files: true
files: ${{ steps.version.outputs.zip_name }}