Skip to content

Commit 40bc9c8

Browse files
committed
Fix NuGet publish issue & Add GitHub releases action
1 parent 7a3dd61 commit 40bc9c8

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

.github/workflows/dotnet.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
env:
1616
Dotnet_Version: 8.0.x
1717
Project_Path: Flow.Launcher.Localization\Flow.Launcher.Localization.csproj
18-
NuGet_Source: 'https://api.nuget.org/v3/index.json'
1918

2019
steps:
2120

@@ -55,5 +54,20 @@ jobs:
5554

5655
# Publish to NuGet.org
5756
- name: Push to NuGet
58-
if: github.event_name == 'push' && github.ref == 'refs/heads/main' # Only publish on push to main
59-
run: dotnet nuget push nupkgs/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s ${{ env.NuGet_Source }}
57+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
58+
run: nuget push nupkgs\*.nupkg -source 'https://api.nuget.org/v3/index.json' -apikey ${{ secrets.NUGET_API_KEY }}
59+
60+
# Get package version
61+
- name: Get Package Version
62+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
63+
run: |
64+
$version = [system.diagnostics.fileversioninfo]::getversioninfo("bin\Release\netstandard2.0\Flow.Launcher.Localization.dll").productversion
65+
echo "release_version=$version" | out-file -filepath $env:github_env -encoding utf-8 -append
66+
67+
# Publish to GitHub releases
68+
- name: Publish GitHub releases
69+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
70+
uses: softprops/action-gh-release@v1
71+
with:
72+
files: "nupkgs\\*.nupkg"
73+
tag_name: "v${{ env.release_version }}"

0 commit comments

Comments
 (0)