diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 4700cab4..ac58e8c4 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -16,24 +16,107 @@ jobs:
- name: Run build
run: ./Build.ps1 -SkipTests
- - name: Read version from csproj
+ # - name: Read version from csproj
+ # run: |
+ # $selectResult = Select-String -Path ".\src\Serilog.Sinks.MSSqlServer\Serilog.Sinks.MSSqlServer.csproj" -Pattern '(.+)'
+ # $versionMatch = $selectResult.Matches[0].Groups[1].Value
+ # echo ("VERSION=" + $versionMatch) >> $env:GITHUB_ENV
+ # echo "Found version $versionMatch"
+
+ # - name: Create GitHub release
+ # if: ${{ github.ref_name == 'main' }}
+ # uses: "marvinpinto/action-automatic-releases@latest"
+ # with:
+ # repo_token: "${{ secrets.GITHUB_TOKEN }}"
+ # prerelease: false
+ # automatic_release_tag: "v${{ env.VERSION }}"
+ # title: "v${{ env.VERSION }}"
+ # files: |
+ # artifacts/*.nupkg
+ # artifacts/*.snupkg
+
+ - name: Extract version from .csproj
+ id: extract_version
+ run: |
+ version=$(grep '' src/Serilog.Sinks.MSSqlServer/Serilog.Sinks.MSSqlServer.csproj | sed -E 's/.*([^<]+)<\/Version>.*/\1/')
+ echo "VERSION=$version" >> $GITHUB_ENV
+ echo "Extracted version: $version"
+
+ - name: Get the last commit message
+ id: last_commit
+ if: ${{ github.ref_name == 'main' }}
+ run: echo "LAST_COMMIT=$(git log -1 --pretty=%B)" >> $GITHUB_ENV
+
+ - name: Get the commits since the last release
+ id: commits_since_last_release
+ if: ${{ github.ref_name == 'main' }}
+ run: |
+ last_tag=$(git describe --tags --abbrev=0)
+ commits=$(git log $last_tag..HEAD --pretty=format:"- %s")
+ echo "COMMITS_SINCE_LAST_RELEASE=$commits" >> $GITHUB_ENV
+
+ - name: Get closed issues since last release
+ id: closed_issues
+ if: ${{ github.ref_name == 'main' }}
+ run: |
+ last_tag=$(git describe --tags --abbrev=0)
+ issues=$(gh issue list --state closed --search "merged:>$last_tag" --json number,title --jq '.[] | "- #" + (.number|tostring) + " " + .title')
+ echo "CLOSED_ISSUES=$issues" >> $GITHUB_ENV
+
+ - name: Get contributors since last release
+ id: contributors
+ if: ${{ github.ref_name == 'main' }}
run: |
- $selectResult = Select-String -Path ".\src\Serilog.Sinks.MSSqlServer\Serilog.Sinks.MSSqlServer.csproj" -Pattern '(.+)'
- $versionMatch = $selectResult.Matches[0].Groups[1].Value
- echo ("VERSION=" + $versionMatch) >> $env:GITHUB_ENV
- echo "Found version $versionMatch"
+ contributors=$(git log --format='%aN <%aE>' $last_tag..HEAD | sort | uniq | awk -F'<|>' '{print $1 " (" $2 ")"}' | sort | uniq | sed 's/^/- /')
+ echo "CONTRIBUTORS=$contributors" >> $GITHUB_ENV
- - name: Create GitHub release
+ - name: Create Git Tag
+ id: create_tag
if: ${{ github.ref_name == 'main' }}
- uses: "marvinpinto/action-automatic-releases@latest"
+ run: |
+ git config user.name "GitHub Actions"
+ git config user.email "actions@github.com"
+ git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}"
+ git push origin "v${{ env.VERSION }}"
+
+ - name: Create Release
+ id: create_release
+ if: ${{ github.ref_name == 'main' }}
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- repo_token: "${{ secrets.GITHUB_TOKEN }}"
+ tag_name: "v${{ env.VERSION }}" # Der Tag-Name, der das Release auslöst
+ release_name: "v${{ env.VERSION }}" # Der Name des Releases
+ body: |
+ ## Details
+ ${{ env.LAST_COMMIT }}
+
+ ## Commits
+ ${{ env.COMMITS_SINCE_LAST_RELEASE }}
+
+ ## Contributors
+ ${{ env.CONTRIBUTORS }}
+ draft: false
prerelease: false
- automatic_release_tag: "v${{ env.VERSION }}"
- title: "v${{ env.VERSION }}"
- files: |
- artifacts/*.nupkg
- artifacts/*.snupkg
+
+ - name: Upload NuGet packages to Release
+ if: ${{ github.ref_name == 'main' }}
+ uses: actions/upload-release-asset@v1
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_path: artifacts/*.nupkg
+ asset_name: serilog.sinks.mssqlserver.${{ env.VERSION }}.nupkg
+ asset_content_type: application/zip
+
+ - name: Upload NuGet symbol packages to Release
+ if: ${{ github.ref_name == 'main' }}
+ uses: actions/upload-release-asset@v1
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_path: artifacts/*.snupkg
+ asset_name: serilog.sinks.mssqlserver.${{ env.VERSION }}.snupkg
+ asset_content_type: application/zip
- name: Publish to nuget.org
env:
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
new file mode 100644
index 00000000..5bd94f14
--- /dev/null
+++ b/DEVELOPMENT.md
@@ -0,0 +1,15 @@
+# Creating Releases
+
+## Creating a dev Release
+
+Whenever the `dev` branch is updated (after merging a pull request), the `Release` action is triggered. This action builds a nuget package with a prerelease identifier of the format `-dev-nnnnn` appended to the version number. This package is automatically published on nuget.org.
+
+## Creating a latest Release
+
+1. On the `dev` branch, update CHANGES.md and `VersionPrefix` and `PackageValidationBaselineVersion` (if applicable, e.g. major version was increased) in Serilog.Sinks.MSSqlServer.csproj.
+
+1. Merge the `dev` branch into `main`. The `Release` action will be triggered. This action builds a nuget package and publishes it on nuget.org. Additionally a release is created in the GitHub repo.
+
+1. Edit the GitHub release and copy the release notes from CHANGES.md.
+
+1. After the release is done, increase the version number in Serilog.Sinks.MSSqlServer.csproj. This ensures that the next dev release will have a higher version number than the latest release.
diff --git a/serilog-sinks-mssqlserver.sln b/serilog-sinks-mssqlserver.sln
index ef9178ee..224100e3 100644
--- a/serilog-sinks-mssqlserver.sln
+++ b/serilog-sinks-mssqlserver.sln
@@ -24,6 +24,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
Build.ps1 = Build.ps1
CHANGES.md = CHANGES.md
+ DEVELOPMENT.md = DEVELOPMENT.md
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
.github\ISSUE_TEMPLATE.md = .github\ISSUE_TEMPLATE.md
diff --git a/src/Serilog.Sinks.MSSqlServer/Serilog.Sinks.MSSqlServer.csproj b/src/Serilog.Sinks.MSSqlServer/Serilog.Sinks.MSSqlServer.csproj
index f701964d..591cbf8f 100644
--- a/src/Serilog.Sinks.MSSqlServer/Serilog.Sinks.MSSqlServer.csproj
+++ b/src/Serilog.Sinks.MSSqlServer/Serilog.Sinks.MSSqlServer.csproj
@@ -1,8 +1,12 @@

+
+
A Serilog sink that writes events to Microsoft SQL Server and Azure SQL
7.0.0
+ true
+ 7.0.0
Michiel van Oudheusden;Christian Kadluba;Serilog Contributors
netstandard2.0;net462;net472;net6.0
true