-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (88 loc) · 3.18 KB
/
stable-release.yml
File metadata and controls
107 lines (88 loc) · 3.18 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Stable Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: read
jobs:
test:
name: Run All Tests
runs-on: [self-hosted, macOS]
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup .NET & Restore
uses: ./.github/actions/setup-dotnet-build
- name: Build
run: dotnet build -c Release --no-restore
- name: Run unit tests
run: >
dotnet test tests/ServiceBusToolset.Application.Tests
-c Release --no-build
- name: Run integration tests
run: >
dotnet test tests/ServiceBusToolset.Integration.Tests
-c Release --no-build
- name: Run CLI integration tests
run: >
dotnet test tests/ServiceBusToolset.CLI.Integration.Tests
-c Release --no-build
stable-release:
runs-on: ubuntu-latest
needs: test
timeout-minutes: 30
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup .NET & Restore
uses: ./.github/actions/setup-dotnet-build
- name: Build
run: dotnet build -c Release --no-restore
- name: Extract version from tag
id: version
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Releasing version: $VERSION"
- name: Pack CLI
env:
VERSION: ${{ steps.version.outputs.version }}
run: dotnet pack src/ServiceBusToolset.CLI -c Release --no-build -o ./artifacts -p:Version="$VERSION"
- name: Pack Application
env:
VERSION: ${{ steps.version.outputs.version }}
run: dotnet pack src/ServiceBusToolset.Application -c Release --no-build -o ./artifacts -p:Version="$VERSION"
- name: Generate SBOM
env:
VERSION: ${{ steps.version.outputs.version }}
REPO: ${{ github.repository }}
run: |
dotnet tool install --global Microsoft.Sbom.DotNetTool --version 4.1.5
sbom-tool generate \
-b ./artifacts \
-bc src/ServiceBusToolset.CLI \
-pn ServiceBusToolset \
-pv "$VERSION" \
-ps "ServiceBusToolset" \
-nsb "https://github.com/$REPO"
- name: Push to NuGet
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
if [ -z "$NUGET_API_KEY" ]; then
echo "::error::NUGET_API_KEY secret is required for stable releases"
exit 1
fi
dotnet nuget push ./artifacts/*.nupkg --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push ./artifacts/*.snupkg --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Upload package to GitHub Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
with:
files: |
./artifacts/*.nupkg
./artifacts/*.snupkg
./artifacts/_manifest/spdx_2.2/**