Skip to content

Commit

Permalink
Add Publish to NuGet step.
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriktsarpalis committed Feb 13, 2025
1 parent a022374 commit ed19af8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
47 changes: 25 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ name: Build & Test

on:
push:
branches:
- "main"
branches: ["main"]
pull_request:
branches:
- "main"
branches: ["main"]
release:
types: ["published"]

jobs:
Linux:
runs-on: ubuntu-latest
Windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
Expand All @@ -22,9 +22,26 @@ jobs:
dotnet-version: 9.0.x
- name: Build & Test
run: make
- name: Upload artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: artifacts/
- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
files: artifacts/*/*.cobertura.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Publish packages to Feedz.io
if: github.event_name == 'push'
run: make push NUGET_SOURCE=https://f.feedz.io/eiriktsarpalis/polytype/nuget/index.json NUGET_API_KEY=${{ secrets.FEEDZ_IO_KEY }}
- name: Publish packages to NuGet
if: github.event_name == 'release'
run: make push NUGET_SOURCE=https://api.nuget.org/v3/index.json NUGET_API_KEY=${{ secrets.NUGET_API_KEY }}

Windows:
runs-on: windows-latest
Linux:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
Expand All @@ -36,20 +53,6 @@ jobs:
dotnet-version: 9.0.x
- name: Build & Test
run: make
- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
files: artifacts/*/*.cobertura.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload packages
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: artifacts/**/*.nupkg
- name: Publish packages to Feedz.io
if: github.ref == 'refs/heads/main'
run: make push NUGET_SOURCE=https://f.feedz.io/eiriktsarpalis/polytype/nuget/index.json NUGET_API_KEY=${{ secrets.FEEDZ_IO_KEY }}

MacOS:
runs-on: macos-latest
Expand Down
3 changes: 2 additions & 1 deletion version.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.26",
"publicReleaseRefSpec": [
"^refs/heads/main$",
"^refs/heads/v\\d+(?:\\.\\d+)?$"
"^refs/heads/v\\d+(?:\\.\\d+)?$",
"^refs/tags/v\\d+(?:\\.\\d+)?"
]
}

0 comments on commit ed19af8

Please sign in to comment.