Skip to content

Commit

Permalink
chore: 发版自动生成 releaseNote
Browse files Browse the repository at this point in the history
  • Loading branch information
Mereithhh committed Aug 29, 2022
1 parent 7d1f1d3 commit 78bac47
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,17 @@ jobs:
tags: |
"docker.io/mereith/van-blog:${{ steps.get_version.outputs.VERSION }}"
"docker.io/mereith/van-blog:latest"
- name: 设置 Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
- name: generateReleaseNote
run: yarn release-note
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: CHANGE.md
- name: updateVersionToApiServer
run: |
curl -X POST "${{ secrets.VERSIONURL }}${{ steps.get_version.outputs.VERSION }}"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"scripts": {
"sync-aliyun": "bash scripts/sync-aliyuncs.sh",
"release": "standard-version",
"release-note": "node scripts/releaseNote.js",
"release-doc": "node scripts/releaseDoc.js",
"release-major": "standard-version --release-as major",
"release-minor": "standard-version --release-as minor",
Expand Down
11 changes: 11 additions & 0 deletions scripts/releaseNote.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const fs = require("fs");
const run = () => {
const changelog = fs.readFileSync("CHANGELOG.md", { encoding: "utf-8" });
const c = changelog
.split("### [")
.slice(0, 2)
.join("### [")
.replace("# Changelog", "");
fs.writeFileSync("CHANGE.md", c, { encoding: "utf-8" });
};
run();

0 comments on commit 78bac47

Please sign in to comment.