Skip to content

Commit 11073cf

Browse files
geevensinghCopilot
andcommitted
DiffViewer: add release workflow and PR/master CI
release.yml: triggers on v[0-9]+.[0-9]+.[0-9]+ tags, publishes single-file exe to GitHub Releases with the tag annotation as body. build.yml: builds + tests on every push to master and every PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 61d48e3 commit 11073cf

2 files changed

Lines changed: 88 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
runs-on: windows-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup .NET
16+
uses: actions/setup-dotnet@v4
17+
with:
18+
dotnet-version: 8.0.x
19+
20+
- name: Restore
21+
run: dotnet restore
22+
23+
- name: Build
24+
run: dotnet build -c Release --no-restore
25+
26+
- name: Test
27+
run: dotnet test -c Release --no-build --logger "console;verbosity=normal"

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
- 'v[0-9]+.[0-9]+.[0-9]+-*'
8+
9+
permissions:
10+
contents: write
11+
12+
concurrency:
13+
group: release-${{ github.ref }}
14+
cancel-in-progress: false
15+
16+
jobs:
17+
release:
18+
runs-on: windows-latest
19+
steps:
20+
- name: Checkout (with full history + tags)
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
fetch-tags: true
25+
26+
- name: Setup .NET
27+
uses: actions/setup-dotnet@v4
28+
with:
29+
dotnet-version: 8.0.x
30+
31+
- name: Stamp version + publish
32+
shell: pwsh
33+
run: |
34+
$version = $env:GITHUB_REF_NAME.TrimStart('v')
35+
Write-Host "Publishing version: $version"
36+
dotnet publish DiffViewer\DiffViewer.csproj `
37+
-c Release `
38+
-o publish `
39+
-p:Version=$version `
40+
-p:FileVersion=$($version -replace '-.*$', '') `
41+
-p:InformationalVersion=$version
42+
if (-not (Test-Path 'publish\DiffViewer.exe')) {
43+
Write-Error 'publish\DiffViewer.exe not found after publish'
44+
exit 1
45+
}
46+
47+
- name: Read tag annotation
48+
shell: pwsh
49+
run: |
50+
git fetch --tags --force
51+
$msg = git for-each-ref "refs/tags/$env:GITHUB_REF_NAME" --format='%(contents)'
52+
if ([string]::IsNullOrWhiteSpace($msg)) { $msg = "Release $env:GITHUB_REF_NAME" }
53+
Write-Host "Tag message length: $($msg.Length)"
54+
"TAG_MSG<<EOF`n$msg`nEOF" | Out-File -Append -Encoding utf8 $env:GITHUB_ENV
55+
56+
- name: Publish GitHub Release
57+
uses: softprops/action-gh-release@v2
58+
with:
59+
files: publish/DiffViewer.exe
60+
body: ${{ env.TAG_MSG }}
61+
fail_on_unmatched_files: true

0 commit comments

Comments
 (0)