Skip to content

Merge pull request #5 from kwtc/feature/project-structure-and-offer-s… #1

Merge pull request #5 from kwtc/feature/project-structure-and-offer-s…

Merge pull request #5 from kwtc/feature/project-structure-and-offer-s… #1

Workflow file for this run

name: Publish
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Verify commit exists in origin/main
run: git branch --remote --contains | grep origin/main
- name: Extract release notes
run: |
git log --pretty=format:'%d %s' ${GITHUB_REF} | perl -pe 's| \(.*tag: v(\d+.\d+.\d+(-preview\d{3})?)(, .*?)*\)|\n## \1\n|g' > RELEASE-NOTES
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Build
run: dotnet build -c Release /p:Version=${VERSION}
- name: Test
run: dotnet test -c Release /p:Version=${VERSION} --no-build
- name: Pack
run: dotnet pack -c Release /p:Version=${VERSION} --no-build --output .
- name: Push package to Nuget.org
run: dotnet nuget push **\*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
- name: Push package to Github
run: dotnet nuget push **\*.nupkg --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/kwtc/index.json