Skip to content

Commit 7b201b2

Browse files
committed
github release action
1 parent af9d8f8 commit 7b201b2

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
name: Pack and publish
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v5
19+
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v5
22+
with:
23+
dotnet-version: 10.0.x
24+
25+
- name: Set package version
26+
id: version
27+
shell: bash
28+
run: |
29+
echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
30+
31+
- name: Restore
32+
run: dotnet restore CsvExport/CsvExport.csproj
33+
34+
- name: Pack
35+
run: dotnet pack CsvExport/CsvExport.csproj --configuration Release --no-restore --output ./artifacts /p:PackageVersion=${{ steps.version.outputs.version }}
36+
37+
- name: Create GitHub release
38+
env:
39+
GH_TOKEN: ${{ github.token }}
40+
run: gh release create "${GITHUB_REF_NAME}" ./artifacts/*.nupkg --title "${GITHUB_REF_NAME}" --generate-notes
41+
42+
- name: Publish to NuGet
43+
run: dotnet nuget push ./artifacts/*.nupkg --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate

0 commit comments

Comments
 (0)