-
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (60 loc) · 2.49 KB
/
release.yml
File metadata and controls
74 lines (60 loc) · 2.49 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
publish:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore ShellUI.sln
- name: Build
run: dotnet build ShellUI.sln --no-restore --configuration Release
- name: Run tests
run: dotnet test ShellUI.sln --no-restore --no-build --configuration Release --verbosity normal
- name: Pack NuGet packages
run: dotnet pack ShellUI.sln --no-build --configuration Release -p:ContinuousIntegrationBuild=true
- name: Publish to NuGet
run: |
dotnet nuget push src/ShellUI.CLI/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
if ls src/ShellUI.CLI/bin/Release/*.snupkg 1> /dev/null 2>&1; then
dotnet nuget push src/ShellUI.CLI/bin/Release/*.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
fi
dotnet nuget push src/ShellUI.Components/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
if ls src/ShellUI.Components/bin/Release/*.snupkg 1> /dev/null 2>&1; then
dotnet nuget push src/ShellUI.Components/bin/Release/*.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
fi
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ShellUI v${{ steps.version.outputs.VERSION }}
body_path: docs/RELEASE_NOTES.md
draft: false
prerelease: ${{ contains(github.ref, '-') }}
files: |
src/ShellUI.CLI/bin/Release/*.nupkg
src/ShellUI.Components/bin/Release/*.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}