forked from rex706/SAM
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (64 loc) · 2.31 KB
/
Copy pathrelease.yml
File metadata and controls
79 lines (64 loc) · 2.31 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Restore + Build (Release)
run: msbuild SAM.sln -restore -t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" /m /v:minimal
- name: Verify Fody/Costura embedded assemblies
shell: pwsh
run: |
$exe = "bin/Release/SAM.exe"
if (-not (Test-Path $exe)) { throw "SAM.exe not found at $exe" }
$size = (Get-Item $exe).Length
Write-Host "SAM.exe size: $size bytes"
if ($size -lt 4000000) {
throw "SAM.exe is $size bytes (under 4 MB) — Costura.Fody likely did not embed dependencies (upstream releases are ~4.27 MB). Aborting release."
}
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: SAM
path: bin/Release/SAM.exe
if-no-files-found: error
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: bin/Release/SAM.exe
generate_release_notes: true
draft: false
prerelease: false
- name: Update latest.txt on master
continue-on-error: true
shell: pwsh
run: |
$tag = "${{ github.ref_name }}"
$version = $tag.TrimStart('v')
$downloadUrl = "https://github.com/${{ github.repository }}/releases/download/$tag/SAM.exe"
$content = "$version`n$downloadUrl`n"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin master
git checkout master
git pull --rebase origin master
Set-Content -Path latest.txt -Value $content -NoNewline -Encoding utf8
git diff --quiet latest.txt
if ($LASTEXITCODE -ne 0) {
git add latest.txt
git commit -m "Bump latest.txt to $version [skip ci]"
git push origin master
} else {
Write-Host "latest.txt already up to date for $version"
}