-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (42 loc) · 1.52 KB
/
nuget.yml
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
name: NuGet Publish
on:
push:
tags:
- 'v*.*.*' # Specify the tag pattern, e.g., 'v1.0.0'
jobs:
deploy:
name: Deploy
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
8.0.x
- uses: actions/cache@v2
id: cacheStep
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Set VERSION variable from tag
run: |
$VERSION=$Env:GITHUB_REF_NAME.TrimStart("v")
echo "VERSION=$VERSION" >> $Env:GITHUB_ENV
- name: Restore dependencies
run: dotnet restore
- name: Setup NuGet.exe for use with actions
uses: NuGet/[email protected]
- name: Restore NuGet
if: steps.cacheStep.outputs.cache-hit != 'true'
run: nuget restore Mapperic.sln
- name: Build Mapperic
run: dotnet build Mapperic/Mapperic.csproj --no-restore --configuration Release /p:Version=$Env:VERSION /p:AssemblyVersion=$Env:VERSION
- name: Build Mapperic.Attributes
run: dotnet build Mapperic.Attributes/Mapperic.Attributes.csproj --no-restore --configuration Release /p:Version=$Env:VERSION /p:AssemblyVersion=$Env:VERSION
- name: Publish NuGet package
run: dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key $Env:NUGET_API_KEY
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}