Skip to content

Commit 73d4ed8

Browse files
author
agile.zhou
committed
ci: generate GitHub release notes
1 parent 7faa691 commit 73d4ed8

7 files changed

Lines changed: 146 additions & 30 deletions

File tree

.github/pull_request_template.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Summary
2+
3+
Describe what changed and why.
4+
5+
## User-facing changes
6+
7+
Describe the behavior visible to users, or write `None` for internal-only changes.
8+
9+
## Release notes
10+
11+
Maintainers: apply the most appropriate release label before merging. Use
12+
`skip-release-notes` only when this pull request should not appear in a release.
13+
14+
- `breaking-change`
15+
- `enhancement` or `feature`
16+
- `bug` or `fix`
17+
- `performance`
18+
- `security`
19+
- `dependencies`, `build`, or `ci`
20+
- `documentation`
21+
22+
## Verification
23+
24+
Describe the tests or checks performed.

.github/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- skip-release-notes
5+
categories:
6+
- title: Breaking Changes
7+
labels:
8+
- breaking-change
9+
- title: New Features
10+
labels:
11+
- enhancement
12+
- feature
13+
- title: Bug Fixes
14+
labels:
15+
- bug
16+
- fix
17+
- title: Performance
18+
labels:
19+
- performance
20+
- title: Security
21+
labels:
22+
- security
23+
- title: Dependencies and Operations
24+
labels:
25+
- dependencies
26+
- build
27+
- ci
28+
- title: Documentation
29+
labels:
30+
- documentation
31+
- title: Other Changes
32+
labels:
33+
- "*"

.github/workflows/release-xxx.yml

Lines changed: 78 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
name: package workflow
1+
name: release workflow
22

33
on:
44
push:
5-
paths-ignore:
6-
- '**/*.md'
7-
- '**/*.yml'
8-
tags:
5+
tags:
96
- 'v-*'
10-
workflow_dispatch:
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: Existing v-* tag to release
11+
required: true
12+
type: string
13+
14+
permissions:
15+
contents: read
16+
17+
env:
18+
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
19+
1120
jobs:
1221
build-reactapp:
1322
runs-on: ubuntu-latest
@@ -19,13 +28,15 @@ jobs:
1928
node-version: [16.x]
2029

2130
steps:
22-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v4
32+
with:
33+
ref: ${{ env.RELEASE_TAG }}
2334
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v1
35+
uses: actions/setup-node@v4
2536
with:
2637
node-version: ${{ matrix.node-version }}
27-
28-
- run: npm install
38+
39+
- run: npm ci
2940
- run: npm run build
3041
- uses: actions/upload-artifact@v4
3142
with:
@@ -34,39 +45,82 @@ jobs:
3445
build-dotnet:
3546
needs: build-reactapp
3647
runs-on: ubuntu-latest
48+
permissions:
49+
contents: write
3750

3851
steps:
3952
- uses: actions/checkout@v4
53+
with:
54+
fetch-depth: 0
55+
ref: ${{ env.RELEASE_TAG }}
4056
- name: setup .net
4157
uses: actions/setup-dotnet@v4
4258
with:
43-
dotnet-version: |
59+
dotnet-version: |
4460
8.0.x
4561
9.0.x
4662
10.0.x
63+
- name: Validate release version
64+
id: release-info
65+
shell: bash
66+
env:
67+
PROJECT_FILE: src/AgileConfig.Server.Apisite/AgileConfig.Server.Apisite.csproj
68+
run: |
69+
if [[ "$RELEASE_TAG" != v-* ]]; then
70+
echo "Release tag must start with v-. Got: $RELEASE_TAG" >&2
71+
exit 1
72+
fi
73+
74+
tag_version="${RELEASE_TAG#v-}"
75+
project_version="$(dotnet msbuild "$PROJECT_FILE" -getProperty:Version -nologo | xargs)"
76+
77+
if [[ "$tag_version" != "$project_version" ]]; then
78+
echo "Tag version $tag_version does not match project version $project_version." >&2
79+
exit 1
80+
fi
81+
82+
prerelease=false
83+
if [[ "$tag_version" == *-* ]]; then
84+
prerelease=true
85+
fi
86+
87+
previous_tag="$(git describe --tags --abbrev=0 "$RELEASE_TAG^" --match 'v-*')"
88+
89+
echo "version=$tag_version" >> "$GITHUB_OUTPUT"
90+
echo "prerelease=$prerelease" >> "$GITHUB_OUTPUT"
91+
echo "previous_tag=$previous_tag" >> "$GITHUB_OUTPUT"
4792
- name: Install dependencies
4893
run: dotnet restore
4994
- name: Build
5095
run: dotnet build --configuration Release --no-restore
96+
- name: Test
97+
run: dotnet test --configuration Release --no-build --verbosity normal
5198
- uses: actions/download-artifact@v4
5299
with:
53100
name: agileconfig-ui
54101
path: src/AgileConfig.Server.Apisite/wwwroot/ui
55-
- name: build server release xxx
56-
run: dotnet publish src/AgileConfig.Server.Apisite/AgileConfig.Server.Apisite.csproj -c Release
57-
- uses: vimtor/action-zip@v1
58-
with:
59-
files: src/AgileConfig.Server.Apisite/bin/Release/net10.0/publish/
60-
dest: agileconfig_server_deploy.zip
61-
- name: create release
62-
uses: ncipollo/release-action@v1
63-
with:
64-
artifacts: agileconfig_server_deploy.zip
65-
token: ${{ secrets.GITHUB_TOKEN }}
66-
- name: Push to Docker hub release -xxx
102+
- name: Publish server
103+
run: dotnet publish src/AgileConfig.Server.Apisite/AgileConfig.Server.Apisite.csproj --configuration Release --no-restore
104+
- name: Package server
105+
working-directory: src/AgileConfig.Server.Apisite/bin/Release/net10.0/publish
106+
env:
107+
VERSION: ${{ steps.release-info.outputs.version }}
108+
run: zip -r "$GITHUB_WORKSPACE/agileconfig-server-$VERSION.zip" .
109+
- name: Push version image to Docker Hub
67110
uses: docker/build-push-action@v1
68111
with:
69112
username: ${{ secrets.DOCKER_HUB_NAME }}
70113
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
71114
repository: kklldog/agile_config
72-
tag_with_ref: true
115+
tags: ${{ env.RELEASE_TAG }}
116+
- name: Create GitHub release
117+
uses: ncipollo/release-action@v1
118+
with:
119+
artifacts: agileconfig-server-${{ steps.release-info.outputs.version }}.zip
120+
generateReleaseNotes: true
121+
generateReleaseNotesPreviousTag: ${{ steps.release-info.outputs.previous_tag }}
122+
makeLatest: ${{ steps.release-info.outputs.prerelease == 'false' }}
123+
name: ${{ env.RELEASE_TAG }}
124+
prerelease: ${{ steps.release-info.outputs.prerelease }}
125+
tag: ${{ env.RELEASE_TAG }}
126+
token: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Change log
2+
3+
> Starting with v-1.12.8, release notes are maintained in
4+
> [GitHub Releases](https://github.com/dotnetcore/AgileConfig/releases).
5+
> This file is retained as a historical archive for earlier versions.
6+
27
------------------------------
38
[1.12.2]
49
* Build the React admin UI inside the Dockerfile so `docker build .` produces a working image (#240)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ https://github.com/dotnetcore/AgileConfig/wiki
5050

5151
API:
5252
[restful api](https://github.com/dotnetcore/AgileConfig/wiki/Restful-API)
53-
## ChangeLog
54-
[Changelog](https://github.com/dotnetcore/AgileConfig/blob/master/CHANGELOG.md)
53+
## Release notes
54+
[GitHub Releases](https://github.com/dotnetcore/AgileConfig/releases)
5555
## architecture
5656
![](https://s1.ax1x.com/2020/06/29/NRz1gO.png)
5757
### client

README_CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ JAVA 客户端项目:[AgileConfig_JClient](https://github.com/kklldog/agilecon
5555
Restful API:
5656
[✈️ restful api](https://github.com/kklldog/AgileConfig/wiki/Restful-API)
5757

58-
## ChangeLog
59-
[📝 Changelog](https://github.com/kklldog/AgileConfig/blob/master/CHANGELOG.md)
58+
## 版本变更
59+
[📝 GitHub Releases](https://github.com/dotnetcore/AgileConfig/releases)
6060

6161
## 联系作者
6262
[📧 联系](#联系我)

README_EN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ https://github.com/kklldog/AgileConfig/wiki
4949

5050
API:
5151
[restful api](https://github.com/kklldog/AgileConfig/wiki/Restful-API)
52-
## ChangeLog
53-
[Changelog](https://github.com/kklldog/AgileConfig/blob/master/CHANGELOG.md)
52+
## Release notes
53+
[GitHub Releases](https://github.com/dotnetcore/AgileConfig/releases)
5454
## architecture
5555
![](https://s1.ax1x.com/2020/06/29/NRz1gO.png)
5656
### client

0 commit comments

Comments
 (0)