-
Notifications
You must be signed in to change notification settings - Fork 1
123 lines (100 loc) · 3.24 KB
/
release.yaml
File metadata and controls
123 lines (100 loc) · 3.24 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- rid: linux-x64
os: ubuntu-24.04
- rid: linux-arm64
os: ubuntu-24.04-arm
- rid: osx-arm64
os: macos-15
- rid: win-x64
os: windows-2025
- rid: win-arm64
os: windows-2025
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.0.x"
dotnet-quality: "ga"
- name: Publish
run: dotnet publish funURL.CLI -c Release -r ${{ matrix.rid }} -o publish
- name: Copy README and LICENSE
shell: pwsh
run: Copy-Item README.md, LICENSE.md -Destination publish/
- name: Archive
shell: pwsh
run: Compress-Archive -Path publish/* -DestinationPath funurl-${{ matrix.rid }}.zip
- name: Upload artifact
uses: actions/upload-artifact@v5
with:
name: funurl-${{ matrix.rid }}
path: funurl-${{ matrix.rid }}.zip
- name: Extract version from tag
id: pkg_version
shell: bash
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Pack platform-specific tool
run: dotnet pack funURL.CLI -c Release -r ${{ matrix.rid }} -p:Version=${{ steps.pkg_version.outputs.version }} -o nupkgs
- name: Upload nupkg
uses: actions/upload-artifact@v5
with:
name: nupkg-${{ matrix.rid }}
path: nupkgs/*.nupkg
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download artifacts
uses: actions/download-artifact@v5
with:
path: artifacts
merge-multiple: true
- name: Determine version
id: version
run: echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
- name: Validate version
run: |
TAG="${{ steps.version.outputs.tag }}"
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Invalid version tag '$TAG'. Must match semver format (e.g. v1.0.0)."
exit 1
fi
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.0.x"
dotnet-quality: "ga"
- name: Extract version from tag
id: pkg_version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Pack root dotnet tool package
run: dotnet pack funURL.CLI -c Release -p:Version=${{ steps.pkg_version.outputs.version }} -o nupkgs
- name: Push to NuGet
run: |
for pkg in artifacts/*.nupkg nupkgs/*.nupkg; do
dotnet nuget push "$pkg" \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
done
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: >
gh release create "${{ steps.version.outputs.tag }}"
artifacts/*.zip
--title "${{ steps.version.outputs.tag }}"
--generate-notes