Skip to content

Commit 7f174c1

Browse files
committed
Update publish.yml
Changing windows agent to ubuntu agent, and trying again to pack and push nuget package
1 parent ef4c4da commit 7f174c1

File tree

1 file changed

+58
-9
lines changed

1 file changed

+58
-9
lines changed

.github/workflows/publish.yml

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
build-and-test:
11-
runs-on: windows-latest
11+
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout code
1414
uses: actions/checkout@v3
@@ -29,7 +29,9 @@ jobs:
2929

3030
publish:
3131
needs: build-and-test
32-
runs-on: windows-latest
32+
runs-on: ubuntu-latest
33+
outputs:
34+
version: ${{ steps.set-version.outputs.version }}
3335
steps:
3436
- name: Checkout code
3537
uses: actions/checkout@v3
@@ -44,12 +46,59 @@ jobs:
4446

4547
- name: Build solution
4648
run: dotnet build --no-restore --configuration Release
47-
48-
- name: Pack NuGet package
49-
run: dotnet pack src/Orbyss.Blazor.JsonForms.csproj --configuration Release --no-build
5049

51-
- name: Debug => List .nupkg files
52-
run: ls -R src/bin/Release
50+
- name: Extract version from tag
51+
id: set-version
52+
run: |
53+
VERSION="${GITHUB_REF#refs/tags/v}"
54+
echo "Using version: $VERSION"
55+
echo "version=$VERSION" >> $GITHUB_OUTPUT
5356
54-
- name: Push to NuGet.org
55-
run: dotnet nuget push src/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
57+
- name: Pack NuGet packages
58+
run: |
59+
VERSION=${{ steps.set-version.outputs.version }}
60+
dotnet pack src/${{ github.event.repository.name }}.csproj \
61+
--configuration Release \
62+
--no-build \
63+
-p:PackageVersion=$VERSION \
64+
-p:IncludeSymbols=true \
65+
-p:SymbolPackageFormat=snupkg
66+
67+
- name: Show packed files
68+
run: ls -lh src/bin/Release
69+
70+
- name: Push packages to NuGet
71+
run: |
72+
for pkg in $(find src/bin/Release -name "*.nupkg"); do
73+
echo "Pushing $pkg"
74+
dotnet nuget push "$pkg" \
75+
--api-key "${{ secrets.NUGET_API_KEY }}" \
76+
--source https://api.nuget.org/v3/index.json \
77+
--skip-duplicate
78+
done
79+
80+
- name: Copy main .nupkg for release
81+
run: |
82+
mkdir package
83+
cp $(find src/bin/Release -maxdepth 1 -name "*.nupkg" -not -name "*.symbols.nupkg") ./package/
84+
85+
- name: Upload package artifact
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: nuget-package
89+
path: package/*.nupkg
90+
91+
release:
92+
needs: publish
93+
runs-on: ubuntu-latest
94+
steps:
95+
- name: Download packaged artifact
96+
uses: actions/download-artifact@v4
97+
with:
98+
name: nuget-package
99+
100+
- name: Create GitHub Release
101+
uses: softprops/action-gh-release@v1
102+
with:
103+
generate_release_notes: true
104+
files: "*.nupkg"

0 commit comments

Comments
 (0)