-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (87 loc) · 3.69 KB
/
Copy pathrelease.yml
File metadata and controls
98 lines (87 loc) · 3.69 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
93
94
95
96
97
98
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
- name: Publish app (self-contained single file)
run: >
dotnet publish TaskTracker -c Release -r win-x64 --self-contained
-p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
-o publish/app
- name: Publish MCP server
run: >
dotnet publish TaskTracker.Mcp -c Release -r win-x64 --self-contained
-p:PublishSingleFile=true
-o publish/mcp
# The global tool is how anyone outside a clone of this repo registers the
# server, and the README told them to clone it and pack locally — which
# defeats the point. The package ships with the release now.
- name: Pack MCP server as a global tool
run: dotnet pack TaskTracker.Mcp -c Release
# A tag that disagrees with <Version> is exactly what makes an installed tool
# un-updatable: `dotnet tool update` no-ops on an equal version, so shipping
# v2.1.0 built from <Version>2.0.0 leaves everyone silently on old code.
- name: Check the tag matches the package version
if: startsWith(github.ref, 'refs/tags/')
shell: pwsh
run: |
$csproj = [xml](Get-Content TaskTracker.Mcp/TaskTracker.Mcp.csproj)
$version = ($csproj.Project.PropertyGroup.Version | Where-Object { $_ }).Trim()
$tag = $env:GITHUB_REF_NAME -replace '^v', ''
if ($version -ne $tag) {
throw "Tag '$env:GITHUB_REF_NAME' does not match TaskTracker.Mcp <Version> '$version'. Bump one to match the other."
}
Write-Host "Tag and package version agree on $version."
- name: Zip artifacts
shell: pwsh
run: |
Compress-Archive -Path publish/app/* -DestinationPath TaskTracker-win-x64.zip
Compress-Archive -Path publish/mcp/* -DestinationPath TaskTracker.Mcp-win-x64.zip
- name: Create GitHub release
if: startsWith(github.ref, 'refs/tags/')
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$nupkg = Get-ChildItem artifacts/nupkg/*.nupkg | Select-Object -First 1
gh release create $env:GITHUB_REF_NAME `
TaskTracker-win-x64.zip TaskTracker.Mcp-win-x64.zip $nupkg.FullName `
--title "TaskTracker $env:GITHUB_REF_NAME" `
--generate-notes
# Optional: set the NUGET_API_KEY secret and installing becomes a plain
# `dotnet tool install --global SebHenn.TaskTracker.Mcp`. Without the secret
# this is skipped rather than failing the release. The key is read through env
# because the secrets context is not usable in an `if:` expression.
- name: Push to NuGet
if: startsWith(github.ref, 'refs/tags/')
shell: pwsh
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
if (-not $env:NUGET_API_KEY) {
Write-Host "No NUGET_API_KEY secret set; skipping the NuGet push."
exit 0
}
dotnet nuget push artifacts/nupkg/*.nupkg `
--api-key $env:NUGET_API_KEY `
--source https://api.nuget.org/v3/index.json `
--skip-duplicate
- name: Upload workflow artifacts (manual runs)
if: "!startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v4
with:
name: TaskTracker-win-x64
path: |
TaskTracker-win-x64.zip
TaskTracker.Mcp-win-x64.zip
artifacts/nupkg/*.nupkg