-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (47 loc) · 1.67 KB
/
Copy pathrelease.yml
File metadata and controls
59 lines (47 loc) · 1.67 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
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
name: Build, Pack, and Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore PowerCSharp.CleanArchitecture.sln
- name: Build
run: dotnet build PowerCSharp.CleanArchitecture.sln --no-restore -c Release
- name: Test
run: dotnet test PowerCSharp.CleanArchitecture.sln --no-build -c Release --verbosity normal
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
- name: Stamp version into template project
run: |
sed -i "s|<PackageVersion>.*</PackageVersion>|<PackageVersion>${{ steps.version.outputs.version }}</PackageVersion>|" \
PowerCSharp.CleanArchitecture.Template.csproj
- name: Pack template NuGet package
run: dotnet pack PowerCSharp.CleanArchitecture.Template.csproj -c Release -o ./nupkg
- name: Publish to nuget.org
run: |
dotnet nuget push ./nupkg/*.nupkg \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ github.ref_name }}" \
./nupkg/*.nupkg \
--title "Release ${{ github.ref_name }}" \
--generate-notes