Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ckadluba committed Sep 20, 2024
1 parent 751a344 commit d3ef644
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
31 changes: 19 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@ jobs:
fetch-depth: 0

- name: Read version from csproj
id: extract_version
if: github.ref == 'refs/heads/main'
run: |
VERSION=$(grep '<VersionPrefix>' src/Serilog.Sinks.MSSqlServer/Serilog.Sinks.MSSqlServer.csproj | sed 's/.*<VersionPrefix>\(.*\)<\/VersionPrefix>.*/\1/')
echo "VERSION=$VERSION" >> $GITHUB_ENV
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
echo "Tag v$VERSION already exists"
exit 1
fi
# Extract the version from the .csproj file using PowerShell XML parsing
[xml]$csproj = Get-Content 'src/Serilog.Sinks.MSSqlServer/Serilog.Sinks.MSSqlServer.csproj'
$version = $csproj.Project.PropertyGroup.VersionPrefix
echo "VERSION=$version" >> $env:GITHUB_ENV
# Check if the tag already exists in git
$tagExists = git tag -l "v$version"
if ($tagExists) {
Write-Host "Tag v$version already exists"
exit 1
}
shell: pwsh

- name: Run build
run: ./Build.ps1 -SkipTests
Expand All @@ -37,20 +42,22 @@ jobs:
if: success() && github.ref == 'refs/heads/main'
run: |
git log -1 --pretty=%B > last_commit_message.txt
shell: pwsh

# Create GitHub release only on main branch (latest release)
- name: Create Release
if: github.ref == 'refs/heads/main' && success()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ env.VERSION }} \
--title "v${{ env.VERSION }}" \
--notes "$(cat last_commit_message.txt)" \
artifacts/*.nupkg artifacts/*.snupkg
gh release create v${{ env.VERSION }} `
--title "v${{ env.VERSION }}" `
--notes "$(Get-Content last_commit_message.txt)" `
artifacts\*.nupkg artifacts\*.snupkg
shell: pwsh

- name: Publish to nuget.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
nuget push artifacts\*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_API_KEY }}
shell: pwsh
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 7.0.1
* Fixed issue #567: .NET Framework assemblies were not built properly
* Consolidated PR validation action workflows and updated some task versions

# 7.0.0
* Fixed issue #543: Update to Serilog v4, remove reference to Serilog.Sinks.PeriodicBatching (thanks to @cancakar35)
Expand Down

0 comments on commit d3ef644

Please sign in to comment.