Skip to content

Commit

Permalink
Add GitHub workflow to publish to GitHub Package registry
Browse files Browse the repository at this point in the history
  • Loading branch information
nickelc committed Mar 29, 2020
1 parent 7fe1faf commit 91639a1
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [pull_request, push]

jobs:
build:
name: build
name: Build

runs-on: ${{ matrix.os }}

Expand All @@ -19,7 +19,7 @@ jobs:
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.102'
dotnet-version: '3.1.101'

- name: Build
run: dotnet build
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release

on:
release:
types: [published]

jobs:
publish:
name: Publish

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.101'

- name: Setup NuGet
uses: nuget/setup-nuget@v1

- name: Setup NuGet source
run: |
nuget sources add -name github \
-source https://nuget.pkg.github.com/nickelc/index.json \
-username nickelc -password ${{ secrets.GITHUB_TOKEN }}
- name: Restore
run: dotnet restore

- name: Build
run: dotnet build -c Release --no-restore -p:Version=${GITHUB_REF##*/v}

- name: Package
run: |
dotnet pack -c Release --no-build -o nupkgs \
-p:PackageVersion=${GITHUB_REF##*/v} \
-p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
- name: Upload
uses: softprops/action-gh-release@v1
with:
files: |
nupkgs/*.nupkg
nupkgs/*.snupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish
run: dotnet nuget push nupkgs/*.nupkg -source github

- name: Publish snupkg
run: dotnet nuget push nupkgs/*.snupkg -source github

0 comments on commit 91639a1

Please sign in to comment.