Skip to content

Commit

Permalink
Publish NuGet and create release in workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
damirarh committed Sep 15, 2024
1 parent ac895a3 commit 2666de8
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/ClockifyExport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ on:
push:
branches:
- main
paths-ignore:
- "**/*.md"
- "**/*.gitignore"
- "**/*.gitattributes"
tags:
- v*
pull_request:
branches:
- main
Expand Down Expand Up @@ -40,6 +38,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
Expand Down Expand Up @@ -81,3 +82,22 @@ jobs:
conclusion: ${{ job.status }}
output: '{"summary":"Code coverage"}'
output_text_description_file: coverage/Summary.md

- name: Check for tag in current commit
run: echo "tag=$(git describe --tags --match 'v*')" >> "GITHUB_ENV"

- name: Create NuGet package
if: startsWith(env.tag, 'v')
run: dotnet pack --configuration Release --no-build

- name: Publish NuGet package
if: startsWith(env.tag, 'v')
run: dotnet nuget push nupkg/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://nuget.org

- name: Create GitHub release
if: startsWith(env.tag, 'v')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.tag }}
prerelease: ${{ contains(env.tag, '-') && '--prerelease' || '' }}
run: gh release create "$tag" nupkg/*.nupkg --generate-notes $prelease

0 comments on commit 2666de8

Please sign in to comment.