Skip to content

Commit 7aa596a

Browse files
committed
wip
1 parent c784537 commit 7aa596a

File tree

1 file changed

+96
-13
lines changed

1 file changed

+96
-13
lines changed

.github/workflows/release.yml

Lines changed: 96 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,107 @@ jobs:
1616
- name: Run build
1717
run: ./Build.ps1 -SkipTests
1818

19-
- name: Read version from csproj
19+
# - name: Read version from csproj
20+
# run: |
21+
# $selectResult = Select-String -Path ".\src\Serilog.Sinks.MSSqlServer\Serilog.Sinks.MSSqlServer.csproj" -Pattern '<VersionPrefix>(.+)</VersionPrefix>'
22+
# $versionMatch = $selectResult.Matches[0].Groups[1].Value
23+
# echo ("VERSION=" + $versionMatch) >> $env:GITHUB_ENV
24+
# echo "Found version $versionMatch"
25+
26+
# - name: Create GitHub release
27+
# if: ${{ github.ref_name == 'main' }}
28+
# uses: "marvinpinto/action-automatic-releases@latest"
29+
# with:
30+
# repo_token: "${{ secrets.GITHUB_TOKEN }}"
31+
# prerelease: false
32+
# automatic_release_tag: "v${{ env.VERSION }}"
33+
# title: "v${{ env.VERSION }}"
34+
# files: |
35+
# artifacts/*.nupkg
36+
# artifacts/*.snupkg
37+
38+
- name: Extract version from .csproj
39+
id: extract_version
40+
run: |
41+
version=$(grep '<Version>' src/Serilog.Sinks.MSSqlServer/Serilog.Sinks.MSSqlServer.csproj | sed -E 's/.*<Version>([^<]+)<\/Version>.*/\1/')
42+
echo "VERSION=$version" >> $GITHUB_ENV
43+
echo "Extracted version: $version"
44+
45+
- name: Get the last commit message
46+
id: last_commit
47+
if: ${{ github.ref_name == 'main' }}
48+
run: echo "LAST_COMMIT=$(git log -1 --pretty=%B)" >> $GITHUB_ENV
49+
50+
- name: Get the commits since the last release
51+
id: commits_since_last_release
52+
if: ${{ github.ref_name == 'main' }}
53+
run: |
54+
last_tag=$(git describe --tags --abbrev=0)
55+
commits=$(git log $last_tag..HEAD --pretty=format:"- %s")
56+
echo "COMMITS_SINCE_LAST_RELEASE=$commits" >> $GITHUB_ENV
57+
58+
- name: Get closed issues since last release
59+
id: closed_issues
60+
if: ${{ github.ref_name == 'main' }}
61+
run: |
62+
last_tag=$(git describe --tags --abbrev=0)
63+
issues=$(gh issue list --state closed --search "merged:>$last_tag" --json number,title --jq '.[] | "- #" + (.number|tostring) + " " + .title')
64+
echo "CLOSED_ISSUES=$issues" >> $GITHUB_ENV
65+
66+
- name: Get contributors since last release
67+
id: contributors
68+
if: ${{ github.ref_name == 'main' }}
2069
run: |
21-
$selectResult = Select-String -Path ".\src\Serilog.Sinks.MSSqlServer\Serilog.Sinks.MSSqlServer.csproj" -Pattern '<VersionPrefix>(.+)</VersionPrefix>'
22-
$versionMatch = $selectResult.Matches[0].Groups[1].Value
23-
echo ("VERSION=" + $versionMatch) >> $env:GITHUB_ENV
24-
echo "Found version $versionMatch"
70+
contributors=$(git log --format='%aN <%aE>' $last_tag..HEAD | sort | uniq | awk -F'<|>' '{print $1 " (" $2 ")"}' | sort | uniq | sed 's/^/- /')
71+
echo "CONTRIBUTORS=$contributors" >> $GITHUB_ENV
2572
26-
- name: Create GitHub release
73+
- name: Create Git Tag
74+
id: create_tag
2775
if: ${{ github.ref_name == 'main' }}
28-
uses: "marvinpinto/action-automatic-releases@latest"
76+
run: |
77+
git config user.name "GitHub Actions"
78+
git config user.email "[email protected]"
79+
git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}"
80+
git push origin "v${{ env.VERSION }}"
81+
82+
- name: Create Release
83+
id: create_release
84+
if: ${{ github.ref_name == 'main' }}
85+
uses: actions/create-release@v1
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2988
with:
30-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
89+
tag_name: "v${{ env.VERSION }}" # Der Tag-Name, der das Release auslöst
90+
release_name: "v${{ env.VERSION }}" # Der Name des Releases
91+
body: |
92+
## Details
93+
${{ env.LAST_COMMIT }}
94+
95+
## Commits
96+
${{ env.COMMITS_SINCE_LAST_RELEASE }}
97+
98+
## Contributors
99+
${{ env.CONTRIBUTORS }}
100+
draft: false
31101
prerelease: false
32-
automatic_release_tag: "v${{ env.VERSION }}"
33-
title: "v${{ env.VERSION }}"
34-
files: |
35-
artifacts/*.nupkg
36-
artifacts/*.snupkg
102+
103+
- name: Upload NuGet packages to Release
104+
if: ${{ github.ref_name == 'main' }}
105+
uses: actions/upload-release-asset@v1
106+
with:
107+
upload_url: ${{ steps.create_release.outputs.upload_url }}
108+
asset_path: artifacts/*.nupkg
109+
asset_name: serilog.sinks.mssqlserver.${{ env.VERSION }}.nupkg
110+
asset_content_type: application/zip
111+
112+
- name: Upload NuGet symbol packages to Release
113+
if: ${{ github.ref_name == 'main' }}
114+
uses: actions/upload-release-asset@v1
115+
with:
116+
upload_url: ${{ steps.create_release.outputs.upload_url }}
117+
asset_path: artifacts/*.snupkg
118+
asset_name: serilog.sinks.mssqlserver.${{ env.VERSION }}.snupkg
119+
asset_content_type: application/zip
37120
38121
- name: Publish to nuget.org
39122
env:

0 commit comments

Comments
 (0)