Skip to content

Commit 9cbfe64

Browse files
committed
Update pack.yml
1 parent c2b634f commit 9cbfe64

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

.github/workflows/pack.yml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,36 @@ jobs:
1818
with:
1919
dotnet-version: 10.0.x
2020

21-
- name: Start
22-
run: cd nupkg
21+
- name: Cache NuGet packages
22+
uses: actions/cache@v4
23+
with:
24+
path: |
25+
~/.nuget/packages
26+
~/.local/share/NuGet/v3-cache
27+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
28+
restore-keys: |
29+
${{ runner.os }}-nuget-
2330
24-
# pack
25-
- name: Pack
26-
run: ./pack.ps1 ${{ github.ref_name }}
27-
28-
# push
29-
- name: Push
30-
run: ./push_packages.ps1 ${{ github.ref_name }} ${{ secrets.NUGET_API_KEY }} ${{ secrets.GIT_PAT }}
31+
- name: Restore & Build & Test
32+
run: |
33+
dotnet restore
34+
dotnet build --no-restore -c Release
35+
dotnet test --no-build -c Release --verbosity normal
36+
shell: bash
37+
38+
- name: Pack
39+
working-directory: nupkg
40+
run: ./pack.ps1 ${{ github.ref_name }}
41+
shell: pwsh
42+
43+
- name: Upload packages as artifact (for debugging)
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: nupkgs
47+
path: nupkg/output/*.nupkg
48+
49+
- name: Push packages
50+
working-directory: nupkg
51+
if: success() && startsWith(github.ref, 'refs/tags/')
52+
run: ./push_packages.ps1 ${{ github.ref_name }} ${{ secrets.NUGET_API_KEY }} ${{ secrets.GIT_PAT }}
53+
shell: pwsh

0 commit comments

Comments
 (0)