Skip to content

Commit 8171fa5

Browse files
committed
Add publish-to-nuget action on 'main', only when version changes
1 parent 404df4f commit 8171fa5

File tree

5 files changed

+32
-40
lines changed

5 files changed

+32
-40
lines changed

.github/workflows/build.yaml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,3 @@ jobs:
1818
# build it, test it, pack it
1919
- name: Run dotnet build (release)
2020
run: ./build.cmd
21-
22-
# deploy:
23-
# name: deploy
24-
# runs-on: ubuntu-latest
25-
# if: github.ref == 'refs/heads/main'
26-
# steps:
27-
# # checkout the code
28-
# - name: checkout-code
29-
# uses: actions/checkout@v3
30-
# with:
31-
# fetch-depth: 0
32-
# # setup dotnet based on global.json
33-
# - name: setup-dotnet
34-
# uses: actions/setup-dotnet@v3
35-
# # push it to nuget
36-
# - name: deploy
37-
# run: make cd
38-
# env:
39-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-

.github/workflows/main.yaml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,3 @@ jobs:
4545
# this path glob pattern requires forward slashes!
4646
path: ./src/FSharp.Control.TaskSeq.Test/TestResults/test-results-release.trx
4747
reporter: dotnet-trx
48-
49-
# deploy:
50-
# name: deploy
51-
# runs-on: ubuntu-latest
52-
# if: github.ref == 'refs/heads/main'
53-
# steps:
54-
# # checkout the code
55-
# - name: checkout-code
56-
# uses: actions/checkout@v3
57-
# with:
58-
# fetch-depth: 0
59-
# # setup dotnet based on global.json
60-
# - name: setup-dotnet
61-
# uses: actions/setup-dotnet@v3
62-
# # push it to nuget
63-
# - name: deploy
64-
# run: make cd
65-
# env:
66-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67-

.github/workflows/publish.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Pack & Publish Nuget
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish:
10+
name: Publish nuget (if new version)
11+
runs-on: windows-latest
12+
steps:
13+
# checkout the code
14+
- name: checkout-code
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
# setup dotnet based on global.json
19+
- name: setup-dotnet
20+
uses: actions/setup-dotnet@v3
21+
# build it, test it, pack it, publish it
22+
- name: Run dotnet build (release, for nuget)
23+
run: ./build.cmd
24+
- name: Nuget publish
25+
# skip-duplicate ensures that the 409 error received when the package was already published,
26+
# will just issue a warning and won't have the GH action fail.
27+
# NUGET_PUBLISH_TOKEN_TASKSEQ is valid until approx. 8 Nov 2023 and will need to be updated by then.
28+
# do so under https://github.com/fsprojects/FSharp.Control.TaskSeq/settings/secrets/actions
29+
# select button "Add repository secret" or update the existing one under "Repository secrets"
30+
run: dotnet nuget push packages\FSharp.Control.TaskSeq.*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_TOKEN_TASKSEQ }} --skip-duplicate

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,3 +349,4 @@ MigrationBackup/
349349
# Ionide (cross platform F# VS Code tools) working folder
350350
.ionide/
351351
*.ncrunchproject
352+
nuget-api-key.txt

src/FSharp.Control.TaskSeq.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
2020
..\.github\workflows\build.yaml = ..\.github\workflows\build.yaml
2121
..\.github\dependabot.yml = ..\.github\dependabot.yml
2222
..\.github\workflows\main.yaml = ..\.github\workflows\main.yaml
23+
..\.github\workflows\publish.yaml = ..\.github\workflows\publish.yaml
2324
..\.github\workflows\test.yaml = ..\.github\workflows\test.yaml
2425
EndProjectSection
2526
EndProject

0 commit comments

Comments
 (0)