Skip to content

Commit

Permalink
Add Release Drafter and update deploy workflow
Browse files Browse the repository at this point in the history
Create a new release drafter configuration and corresponding GitHub Actions workflow for automatic release notes generation. Update the deploy workflow to publish NuGet packages on version tags and to include version extraction from tags.
  • Loading branch information
kerem-acer committed Nov 6, 2024
1 parent fbc0eda commit 4efff71
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 6 deletions.
44 changes: 44 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'maintenance'
- 'refactor'
- title: '📝 Documentation'
labels:
- 'docs'
- 'documentation'
exclude-labels:
- 'skip-changelog'

version-resolver:
major:
labels:
- 'major'
- 'breaking'
minor:
labels:
- 'minor'
- 'feature'
patch:
labels:
- 'patch'
- 'fix'
- 'bugfix'
- 'bug'
default: patch

template: |
## Changes
$CHANGES
14 changes: 8 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Publish NuGet Preview Package
name: Publish NuGet Package

on:
workflow_dispatch: # Manual trigger only
push:
tags:
- 'v*'

env:
PROJECT_PATH: 'src/Core/MongoFlow.csproj'
Expand All @@ -17,9 +19,9 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4

- name: Get commit hash
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get version from tag
id: get_version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

- name: Restore dependencies
run: dotnet restore ${{ env.PROJECT_PATH }}
Expand All @@ -35,7 +37,7 @@ jobs:
dotnet pack ${{ env.PROJECT_PATH }}
--configuration Release
--no-build
-p:PackageVersion=0.1.0-alpha-${{ steps.vars.outputs.sha_short }}
-p:PackageVersion={{ steps.get_version.outputs.version }}
- name: Push to NuGet
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
22 changes: 22 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Release Drafter

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronized]

permissions:
contents: read

jobs:
update_release_draft:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 4efff71

Please sign in to comment.