Skip to content

Commit 70dba6f

Browse files
authored
Merge pull request #184 from fsprojects/fix/workflows
fix(release): update workflows to publish releases
2 parents 747fbc2 + 4e1eaca commit 70dba6f

File tree

4 files changed

+209
-139
lines changed

4 files changed

+209
-139
lines changed

.github/workflows/build.yml

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,58 @@ env:
88

99
on:
1010
push:
11-
branches: [ master ]
11+
tags:
12+
- v[0-9]+.[0-9]+.[0-9]+*
13+
branches: [master]
1214
pull_request:
13-
branches: [ master ]
15+
branches: [master]
16+
release:
1417

1518
jobs:
1619
build:
17-
1820
runs-on: windows-latest
1921
permissions:
2022
packages: write
2123
contents: read
2224

2325
steps:
24-
- name: Checkout
25-
uses: actions/checkout@v4
26-
with:
27-
fetch-depth: 0
28-
- name: Setup .NET Core
29-
uses: actions/setup-dotnet@v4
30-
with:
31-
dotnet-version: |
32-
8.0.x
33-
- name: Restore
34-
run: dotnet tool restore
35-
- name: Build
36-
run: dotnet build -c Release
37-
- name: Test
38-
run: dotnet test --no-build -c Release tests
39-
- name: Pack
40-
run: dotnet pack --no-restore -c Release --include-symbols -o bin
41-
- name: Upload Artifacts
42-
uses: actions/upload-artifact@v4
43-
with:
44-
name: nupkg-${{ matrix.runs-on }}
45-
path: ./bin/*nupkg
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
- name: Setup .NET Core
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: |
34+
8.0.x
35+
- name: Set env
36+
if: startsWith( github.ref, 'refs/tags/v' )
37+
run: |
38+
RELEASE_VERSION="${GITHUB_REF#refs/*/}"
39+
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
40+
echo "Version=${RELEASE_VERSION:1}" >> $GITHUB_ENV
41+
42+
- name: Restore
43+
run: dotnet tool restore
44+
- name: Build
45+
run: dotnet build -c Release
46+
- name: Test
47+
run: dotnet test --no-build -c Release tests
48+
- name: Pack
49+
run: dotnet pack --no-restore -c Release --include-symbols -o bin
50+
51+
- name: Upload Test Results
52+
if: failure()
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: verify-test-results
56+
path: |
57+
**/*.received.*
58+
- name: Upload Artifacts
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: nupkg-${{ matrix.runs-on }}
62+
path: ./bin/*nupkg
63+
- name: Push
64+
if: startsWith( github.ref, 'refs/tags/v' )
65+
run: dotnet nuget push bin\*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_KEY }}

.github/workflows/private-publish.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,25 @@ on:
1111

1212
jobs:
1313
build:
14-
1514
runs-on: windows-latest
1615

1716
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v4
20-
with:
21-
fetch-depth: 0
22-
- name: Setup .NET Core
23-
uses: actions/setup-dotnet@v4
24-
with:
25-
dotnet-version: |
26-
8.0.x
27-
- name: Restore
28-
run: dotnet tool restore
29-
- name: Build
30-
run: dotnet build -c Release
31-
- name: Test
32-
run: dotnet test --no-build -c Release tests
33-
- name: Pack
34-
run: dotnet pack -c Release --include-symbols -o bin
35-
- name: Push Package to Local Feed
36-
run: dotnet nuget push bin\*.nupkg -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -k ${{ secrets.GITHUB_TOKEN }}
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- name: Setup .NET Core
22+
uses: actions/setup-dotnet@v4
23+
with:
24+
dotnet-version: |
25+
8.0.x
26+
- name: Restore
27+
run: dotnet tool restore
28+
- name: Build
29+
run: dotnet build -c Release
30+
- name: Test
31+
run: dotnet test --no-build -c Release tests
32+
- name: Pack
33+
run: dotnet pack --no-restore -c Release --include-symbols -o bin
34+
- name: Push Package to Local Feed
35+
run: dotnet nuget push bin\*.nupkg -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -k ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,32 @@ on:
1111

1212
jobs:
1313
build:
14-
1514
runs-on: windows-latest
1615

1716
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v4
20-
with:
21-
fetch-depth: 0
22-
- name: Setup .NET Core
23-
uses: actions/setup-dotnet@v4
24-
with:
25-
dotnet-version: |
26-
8.0.x
27-
- name: Restore
28-
run: dotnet tool restore
29-
- name: Build
30-
run: dotnet build -c Release
31-
- name: Test
32-
run: dotnet test --no-build -c Release tests
33-
- name: Pack
34-
run: dotnet pack --no-build -c Release --include-symbols -o bin
35-
- name: Push Package to NuGet.org
36-
run: dotnet nuget push bin\*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_KEY }}
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- name: Setup .NET Core
22+
uses: actions/setup-dotnet@v4
23+
with:
24+
dotnet-version: |
25+
8.0.x
26+
- name: Set env
27+
if: startsWith( github.ref, 'refs/tags/v' )
28+
run: |
29+
RELEASE_VERSION="${GITHUB_REF#refs/*/}"
30+
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
31+
echo "Version=${RELEASE_VERSION:1}" >> $GITHUB_ENV
32+
- name: Restore
33+
run: dotnet tool restore
34+
- name: Build
35+
run: dotnet build -c Release
36+
- name: Test
37+
run: dotnet test --no-build -c Release tests
38+
- name: Pack
39+
run: dotnet pack --no-restore -c Release --include-symbols -o bin
40+
- name: Push
41+
if: startsWith( github.ref, 'refs/tags/v' )
42+
run: dotnet nuget push bin\*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_KEY }}

0 commit comments

Comments
 (0)