Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
msojocs committed Dec 13, 2021
1 parent d7fdf27 commit 60568c5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
26 changes: 13 additions & 13 deletions .github/scripts/generate.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const fs = require('fs');
const changeLog = fs.readFileSync("CHANGELOG.md", 'utf-8')
// console.log(changeLog)
const logList = changeLog.split("\r\n## ")
console.log(changeLog)
const logList = changeLog.split("\n## ")
const logObject = {}
let latestVersion = null
for (const log of logList) {
const versionExp = new RegExp(/(v\d+\.\d+\.\d+) \(\d{4}-\d{2}-\d{2}\)([\s\S]+)/)
let version = log.match(versionExp)
const logOfVer = logObject[version[1]] = []
const changeDetail = version[2]
const changeArr = changeDetail.split("\r\n### ")
const changeArr = changeDetail.split("\n### ")

for (const change of changeArr) {
parseChengeLogByType(change, logOfVer)
Expand All @@ -25,24 +25,24 @@ fs.writeFileSync("changelog/latestVersion.json", JSON.stringify(latestVersion))

// Refactor\r\n- **version**: 稳定测试版本\r\n
function parseChengeLogByType(detail, logOfVer){
const changeTypeExp = new RegExp(/(.*?)\r\n([\s\S]+)/)
const changeTypeExp = new RegExp(/(.*?)\n([\s\S]+)/)
if(!changeTypeExp.test(detail))return

let changeType = detail.match(changeTypeExp)

const changesExp = new RegExp(/- \*\*([a-zA-Z]+)\*\*: (.*?)\r/g)
const changesExp = new RegExp(/- \*\*([a-zA-Z]+)\*\*: (.*)/g)
let changes = changeType[2].matchAll(changesExp)
for (const change of changes) {
logOfVer.push(`${changeType[1]}(${change[1]}): ${change[2]}`)
}
}


let a = {
"v1.0.0": {
"refactor": {
"test": "测试",
"discord": "xxx"
}
}
}
// let a = {
// "v1.0.0": {
// "refactor": {
// "test": "测试",
// "discord": "xxx"
// }
// }
// }
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
push:
tags:
- 'v*'
branches: [master]

jobs:
build-release: #job名称
Expand Down

0 comments on commit 60568c5

Please sign in to comment.