Skip to content

Commit f1ac64b

Browse files
authored
Create main.yml
1 parent 134c716 commit f1ac64b

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/main.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build and Release NuGet Package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
# Checkout the repository
14+
- uses: actions/checkout@v3
15+
16+
# Setup .NET (adjust the version if needed)
17+
- name: Setup .NET
18+
uses: actions/setup-dotnet@v3
19+
with:
20+
dotnet-version: '8.0.x'
21+
22+
# Restore dependencies explicitly in the Clap.Net subfolder
23+
- name: Restore Dependencies
24+
working-directory: ./Clap.Net
25+
run: dotnet restore
26+
27+
# Generate version string (0.1.<run_number>-beta)
28+
# Note: Adjust versioning logic here if you need a more granular version number
29+
- name: Set version number
30+
id: version
31+
run: echo "version=0.1.${GITHUB_RUN_NUMBER}-beta" >> $GITHUB_OUTPUT
32+
33+
# Ensure the artifacts folder exists at the root of the repository
34+
- name: Create artifacts folder
35+
run: mkdir -p artifacts
36+
37+
# Pack the NuGet package from the Clap.Net subfolder
38+
- name: Pack NuGet package
39+
working-directory: ./Clap.Net
40+
run: dotnet pack -c Release -o ../artifacts -p:Version=${{ steps.version.outputs.version }}
41+
42+
# Optional: Verify the package file exists and follows the expected naming pattern
43+
- name: List generated package files
44+
run: ls -l ../artifacts/Clap.Net.*.nupkg
45+
46+
# Push the NuGet package to NuGet.org using the secret API key scoped to Clap.Net
47+
- name: Publish NuGet package
48+
run: dotnet nuget push ../artifacts/Clap.Net.*.nupkg -k ${{ secrets.NUGET_CLAP_NET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate

0 commit comments

Comments
 (0)