@@ -10,9 +10,95 @@ permissions:
1010 issues : write # For commenting on issues
1111 pull-requests : write # For commenting on PRs
1212
13+ env :
14+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE : 1
15+ DOTNET_NOLOGO : true
16+ DOTNET_CLI_TELEMETRY_OPTOUT : 1
17+
1318jobs :
19+ # Step 1: Determine next version (dry-run)
20+ version :
21+ name : Calculate Version
22+ runs-on : ubuntu-latest
23+ outputs :
24+ new_release_published : ${{ steps.semantic_dryrun.outputs.new_release_published }}
25+ new_release_version : ${{ steps.semantic_dryrun.outputs.new_release_version }}
26+ steps :
27+ - name : Checkout
28+ uses : actions/checkout@v4
29+ with :
30+ fetch-depth : 0
31+
32+ - name : Setup Node.js
33+ uses : actions/setup-node@v4
34+ with :
35+ node-version : 22
36+
37+ - name : Install dependencies
38+ run : npm ci
39+
40+ - name : Dry-run semantic-release to get next version
41+ id : semantic_dryrun
42+ env :
43+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
44+ run : npx semantic-release --dry-run
45+
46+ # Step 2: Validate that everything builds and tests pass
47+ validate :
48+ name : Build & Test
49+ needs : version
50+ # Only run if there will be a new release
51+ if : needs.version.outputs.new_release_published == 'true'
52+ runs-on : ubuntu-latest
53+ steps :
54+ - name : Checkout
55+ uses : actions/checkout@v4
56+
57+ - name : Setup .NET
58+ uses : actions/setup-dotnet@v4
59+ with :
60+ global-json-file : global.json
61+
62+ - name : Restore
63+ run : make restore
64+
65+ - name : Build
66+ run : make build
67+
68+ - name : Test
69+ run : make test
70+
71+ - name : Pack
72+ run : make package
73+
74+ - name : Install SBOM tool
75+ run : dotnet tool install --global Microsoft.Sbom.DotNetTool || true
76+
77+ - name : Generate SBOM
78+ run : |
79+ mkdir -p artifacts/sbom
80+ sbom-tool generate -b artifacts -bc . -pn Flowrex -pv ${{ needs.version.outputs.new_release_version }} -ps Gurame -nsb https://github.com/gurame/Flowrex -m artifacts/sbom
81+
82+ - name : Upload NuGet packages (for later publish)
83+ uses : actions/upload-artifact@v4
84+ with :
85+ name : nuget-packages
86+ path : artifacts/*.nupkg
87+ if-no-files-found : error
88+ retention-days : 1
89+
90+ - name : Upload SBOM
91+ uses : actions/upload-artifact@v4
92+ with :
93+ name : sbom
94+ path : artifacts/sbom
95+ if-no-files-found : warn
96+ retention-days : 1
97+
98+ # Step 3: Only if validation passed, create the release
1499 release :
15100 name : Semantic Release
101+ needs : [version, validate]
16102 runs-on : ubuntu-latest
17103 steps :
18104 - name : Checkout
@@ -29,6 +115,28 @@ jobs:
29115 run : npm ci
30116
31117 - name : Release
118+ id : semantic
32119 env :
33120 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
34121 run : npx semantic-release
122+
123+ # Step 4: Publish to NuGet
124+ publish :
125+ name : Publish to NuGet
126+ needs : [version, validate, release]
127+ runs-on : ubuntu-latest
128+ steps :
129+ - name : Download NuGet packages
130+ uses : actions/download-artifact@v4
131+ with :
132+ name : nuget-packages
133+ path : artifacts
134+
135+ - name : Publish to NuGet
136+ run : |
137+ dotnet nuget push artifacts/*.nupkg \
138+ --api-key ${{ secrets.NUGET_API_KEY }} \
139+ --source https://api.nuget.org/v3/index.json \
140+ --skip-duplicate
141+ env :
142+ NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
0 commit comments