Skip to content

Commit a987308

Browse files
committed
CI: limit deployment jobs to releases
1 parent 1684eb6 commit a987308

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

.github/workflows/ci.yaml

+24-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: CI/CD
22

33
on:
44
workflow_dispatch:
@@ -12,41 +12,52 @@ on:
1212
- created
1313

1414
jobs:
15-
test:
16-
name: Test
15+
build:
16+
name: Build, Test, and Deploy
1717
runs-on: windows-latest
1818
steps:
1919
- name: 🛒 Checkout
2020
uses: actions/checkout@v2
21+
2122
- name: ✨ Setup .NET 5
2223
uses: actions/setup-dotnet@v1
2324
with:
2425
dotnet-version: "5.0.x"
26+
2527
- name: ✨ Setup .NET 6
2628
uses: actions/setup-dotnet@v1
2729
with:
2830
dotnet-version: "6.0.x"
2931
include-prerelease: true
30-
- name: 🛠️ Setup NuGet
31-
uses: nuget/setup-nuget@v1
32-
with:
33-
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
32+
3433
- name: 🚚 Restore
3534
run: dotnet restore src
35+
3636
- name: 🛠️ Build
37-
run: dotnet build src --configuration Release
37+
run: dotnet build src --configuration Release --no-restore
38+
3839
- name: 🧪 Test
39-
run: dotnet test src
40+
run: dotnet test src --configuration Release --no-build
41+
4042
- name: 📦 Pack
41-
run: dotnet pack src --configuration Release
42-
- name: 💾 Store
43+
run: dotnet pack src --configuration Release --no-build
44+
45+
- name: 💾 Store Release Package
46+
if: github.event_name == 'release'
4347
uses: actions/upload-artifact@v2
4448
with:
4549
name: Packages
4650
retention-days: 1
4751
path: |
4852
src/Spectrogram/bin/Release/*.nupkg
4953
src/Spectrogram/bin/Release/*.snupkg
50-
- name: 🚀 Publish
54+
55+
- name: 🔑 Configure NuGet Secrets
56+
if: github.event_name == 'release'
57+
uses: nuget/setup-nuget@v1
58+
with:
59+
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
60+
61+
- name: 🚀 Deploy Release Package
5162
if: github.event_name == 'release'
52-
run: nuget push "src\Spectrogram\bin\Release\*.nupkg" -SkipDuplicate -Source https://api.nuget.org/v3/index.json
63+
run: nuget push "src\Spectrogram\bin\Release\*.nupkg" -SkipDuplicate -Source https://api.nuget.org/v3/index.json

0 commit comments

Comments
 (0)