Skip to content

Commit fc5511d

Browse files
author
Meyn
committed
Add push workflow
1 parent d6f7feb commit fc5511d

File tree

2 files changed

+59
-2
lines changed

2 files changed

+59
-2
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Publish to NuGet
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on tags like v1.0.0, v1.0.0.0, v1.0, etc.
7+
8+
env:
9+
CONFIGURATION: 'Release'
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup .NET 8
22+
uses: actions/setup-dotnet@v4
23+
with:
24+
dotnet-version: '8.0.x'
25+
26+
- name: Setup .NET 10
27+
uses: actions/setup-dotnet@v4
28+
with:
29+
dotnet-version: '10.0.x'
30+
31+
- name: Extract version from tag
32+
run: |
33+
TAG_NAME=${GITHUB_REF#refs/tags/}
34+
VERSION=${TAG_NAME#v}
35+
echo "VERSION=$VERSION" >> $GITHUB_ENV
36+
echo "Extracted version: $VERSION"
37+
38+
- name: Restore dependencies
39+
run: dotnet restore
40+
41+
- name: Build
42+
run: dotnet build --configuration ${{ env.CONFIGURATION }} --no-restore /p:Version=${{ env.VERSION }}
43+
44+
- name: Test
45+
run: dotnet test --configuration ${{ env.CONFIGURATION }} --no-build --verbosity normal
46+
47+
- name: Pack
48+
run: dotnet pack --configuration ${{ env.CONFIGURATION }} --no-build --output nupkgs /p:PackageVersion=${{ env.VERSION }}
49+
50+
- name: Publish to NuGet
51+
run: dotnet nuget push nupkgs/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
52+
53+
- name: Upload artifacts
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: nuget-packages
57+
path: nupkgs/*.nupkg

Requests/Requests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
<PackageTags>async; channel; priority; request; parallel; </PackageTags>
1717
<RepositoryUrl>https://github.com/TypNull/Requests</RepositoryUrl>
1818
<PackageIcon>logo.png</PackageIcon>
19-
<Version>2.2.1</Version>
19+
<Version>0</Version>
2020
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
2121
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
2222
<PackageId>Shard.Requests</PackageId>
23-
<PackageReleaseNotes>Implement support for overwriting SubsequentRequest property in the Request&lt;&gt; class</PackageReleaseNotes>
23+
<PackageReleaseNotes>Version history on GitHub</PackageReleaseNotes>
2424
</PropertyGroup>
2525

2626
<ItemGroup>

0 commit comments

Comments
 (0)