Skip to content

Commit

Permalink
feat: release tag
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu committed Aug 30, 2023
1 parent 6d393bb commit dd50013
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 76 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
uses: actions/checkout@v3

- name: Install pnpm
run: corepack enable

- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Generate Changlog
run: pnpm changelog

- name: Create Release Tag
id: release_tag
uses: yyx990803/release-tag@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ncipollo/release-action@v1
with:
tag_name: ${{ github.ref }}
body: |
更新内容请查看 [CHANGELOG](https://github.com/jdf2e/nutui/blob/v4/CHANGELOG.md)。
Please refer to [CHANGELOG](https://github.com/jdf2e/nutui/blob/v4/CHANGELOG.md) for details.
draft: true
bodyFile: '.github/changelog.md'
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,8 @@
"dts": "rimraf ./tsc/type && vue-tsc --declaration --emitDeclarationOnly -p ./tsconfig.declaration.json && pnpm generate:types",
"dts:taro": "rimraf ./tsc/type && vue-tsc --declaration --emitDeclarationOnly -p ./tsconfig.declaration.taro.json && pnpm generate:types:taro",
"copy:h5": "node ./scripts/copyh5.cjs",
"copy:taro": "node ./scripts/copytaro.cjs"
},
"standard-version": {
"scripts": {
"postchangelog": "node ./scripts/updateChangelog.js"
}
"copy:taro": "node ./scripts/copytaro.cjs",
"changelog": "node ./scripts/generate-changelog.cjs"
},
"dependencies": {
"@nutui/icons-vue": "^0.1.1",
Expand Down
19 changes: 19 additions & 0 deletions scripts/generate-changelog.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const fs = require('fs-extra');
const path = require('path');
const changelog = fs.readFileSync(path.join(__dirname, '../CHANGELOG.md'), 'utf8');

const getLatestRelease = (cl) => {
const tag1 = cl.indexOf('##')
if (tag1 > -1) {
const tag2 = cl.split('').slice(tag1 + 1, cl.length - 1).join('').indexOf('##')
if (tag2 > -1) {
return cl.substring(tag1, tag2)
}
}
return ''
}
let res = getLatestRelease(changelog);
if (res) {
res += `\n> [CHANGELOG](https://github.com/jdf2e/nutui/blob/v4/CHANGELOG.md)\n`
fs.writeFileSync('.github/changelog.md', res);
}
61 changes: 0 additions & 61 deletions scripts/updateChangelog.js

This file was deleted.

0 comments on commit dd50013

Please sign in to comment.