-
-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (34 loc) · 1.35 KB
/
dotnet_tool_deploy.yml
File metadata and controls
42 lines (34 loc) · 1.35 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
name: Build and Publish .NET Tool
on:
release:
types: [published]
jobs:
build-and-pack:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET SDK
uses: actions/setup-dotnet@v5
with:
# Use the .NET SDK from global.json in the root of the repository.
global-json-file: global.json
- name: Extract version (without v)
id: version
run: |
if [ "${{ github.event_name }}" = "release" ]; then
# Extract version from release tag (remove any 'v' prefix)
VERSION="${{ github.event.release.tag_name }}"
VERSION=${VERSION#v} # Remove 'v' prefix if present
else
VERSION="${{ github.event.inputs.version }}"
VERSION=${VERSION#v} # Remove 'v' prefix if present
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Syncing version: $VERSION"
- name: Build and Pack as .NET tool
run: |
dotnet tool restore
dotnet cake --target Pack-DotNetTool --package-version ${{ steps.version.outputs.version }}
- name: Publish to NuGet
run: dotnet nuget push ./artifacts/nupkgs/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}