-
Notifications
You must be signed in to change notification settings - Fork 21
66 lines (52 loc) · 1.57 KB
/
release.yml
File metadata and controls
66 lines (52 loc) · 1.57 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
name: Release
on:
push:
tags:
- '*'
env:
DOTNET_VERSION: 8.0.203
PACKAGE_ID: dotnet-document
NUPKG_PATH: ./src/DotnetDocument.Tools/nupkg/*.nupkg
PROJECT_PATH: src/DotnetDocument.Tools/DotnetDocument.Tools.csproj
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
# Install tag to version
- name: Install tag to version tool
run: dotnet tool install -g dotnetCampus.TagToVersion
# Update build/Version.props
# This requires NET 3.1
- name: Update build/Version.props with version from tag
run: dotnet TagToVersion -t ${{ github.ref }}
# Setup .NET
- name: Setup .NET ${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
# Restore
- name: Restore
run: dotnet restore
# Build
- name: Build
run: dotnet build --no-restore -c Release
# Pack the tool as nupkg
- name: Pack
run: |
dotnet pack -c Release --no-restore \
-p:PackageID=${{ env.PACKAGE_ID }} \
${{ env.PROJECT_PATH }}
# Upload nupkg to build artifacts
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_ID }}
path: ${{ env.NUPKG_PATH }}
# Push to Nuget
- name: Push to Nuget
run: dotnet nuget push ${{ env.NUPKG_PATH }} --api-key ${{ secrets.NUGET_KEY }} --no-symbols