Skip to content

Commit 5d3d9dd

Browse files
committed
updated workflow
1 parent 92bffee commit 5d3d9dd

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

.github/workflows/publish-to-nuget.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: Build and Deploy to Nuget
2-
32
on:
43
push:
54
tags:
65
- "v*.*.*"
7-
branches: ["main"]
86
pull_request:
97
branches:
108
- main
@@ -17,7 +15,7 @@ jobs:
1715
runs-on: windows-latest
1816
steps:
1917
- name: Checkout repository
20-
uses: actions/checkout@v2
18+
uses: actions/checkout@v3
2119

2220
- name: Set up .NET Core
2321
uses: actions/setup-dotnet@v3
@@ -27,13 +25,23 @@ jobs:
2725
- name: Build
2826
run: dotnet build --configuration ${{ env.BUILD_CONFIG }} ${{ env.SOLUTION }}
2927

28+
- name: Set version
29+
id: set_version
30+
run: |
31+
if [[ ${{ github.ref }} == refs/tags/* ]]; then
32+
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
33+
else
34+
echo "VERSION=0.0.0-${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
35+
fi
36+
3037
- name: Package
3138
run: >
3239
dotnet pack --no-restore --no-build --configuration ${{ env.BUILD_CONFIG }}
33-
-p:PackageVersion=${{ github.ref_name }} --output .
40+
-p:PackageVersion=${{ steps.set_version.outputs.VERSION }} --output .
3441
3542
- name: Publish
43+
if: startsWith(github.ref, 'refs/tags/')
3644
run: >
37-
dotnet nuget push EfLight.${{ github.ref_name }}.nupkg
45+
dotnet nuget push *.nupkg
3846
-s https://nuget.pkg.github.com/thiomajid/index.json
3947
-k ${{ secrets.NUGET_API_KEY }}

0 commit comments

Comments
 (0)