Skip to content

Commit

Permalink
Add publish-to-nuget action on 'main', only when version changes
Browse files Browse the repository at this point in the history
  • Loading branch information
abelbraaksma committed Nov 14, 2022
1 parent 404df4f commit 8171fa5
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 40 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,3 @@ jobs:
# build it, test it, pack it
- name: Run dotnet build (release)
run: ./build.cmd

# deploy:
# name: deploy
# runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/main'
# steps:
# # checkout the code
# - name: checkout-code
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# # setup dotnet based on global.json
# - name: setup-dotnet
# uses: actions/setup-dotnet@v3
# # push it to nuget
# - name: deploy
# run: make cd
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

20 changes: 0 additions & 20 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,3 @@ jobs:
# this path glob pattern requires forward slashes!
path: ./src/FSharp.Control.TaskSeq.Test/TestResults/test-results-release.trx
reporter: dotnet-trx

# deploy:
# name: deploy
# runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/main'
# steps:
# # checkout the code
# - name: checkout-code
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# # setup dotnet based on global.json
# - name: setup-dotnet
# uses: actions/setup-dotnet@v3
# # push it to nuget
# - name: deploy
# run: make cd
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

30 changes: 30 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Pack & Publish Nuget

on:
push:
branches:
- main

jobs:
publish:
name: Publish nuget (if new version)
runs-on: windows-latest
steps:
# checkout the code
- name: checkout-code
uses: actions/checkout@v3
with:
fetch-depth: 0
# setup dotnet based on global.json
- name: setup-dotnet
uses: actions/setup-dotnet@v3
# build it, test it, pack it, publish it
- name: Run dotnet build (release, for nuget)
run: ./build.cmd
- name: Nuget publish
# skip-duplicate ensures that the 409 error received when the package was already published,
# will just issue a warning and won't have the GH action fail.
# NUGET_PUBLISH_TOKEN_TASKSEQ is valid until approx. 8 Nov 2023 and will need to be updated by then.
# do so under https://github.com/fsprojects/FSharp.Control.TaskSeq/settings/secrets/actions
# select button "Add repository secret" or update the existing one under "Repository secrets"
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,4 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
*.ncrunchproject
nuget-api-key.txt
1 change: 1 addition & 0 deletions src/FSharp.Control.TaskSeq.sln
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
..\.github\workflows\build.yaml = ..\.github\workflows\build.yaml
..\.github\dependabot.yml = ..\.github\dependabot.yml
..\.github\workflows\main.yaml = ..\.github\workflows\main.yaml
..\.github\workflows\publish.yaml = ..\.github\workflows\publish.yaml
..\.github\workflows\test.yaml = ..\.github\workflows\test.yaml
EndProjectSection
EndProject
Expand Down

0 comments on commit 8171fa5

Please sign in to comment.