Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/deploy-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
branches: [main]
paths:
- 'packages/rc-ui-lib/docs/**'
- 'packages/rc-ui-lib/src/**'

jobs:
build-and-deploy:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/issue-close-require.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Issue Close Require

on:
schedule:
- cron: '0 0 * * *'

permissions:
contents: read

jobs:
issue-close-require:
permissions:
issues: write
runs-on: ubuntu-latest
steps:
- name: need reproduce
uses: actions-cool/issues-helper@v3
with:
actions: 'close-issues'
labels: 'need reproduce'
inactive-day: 3
body: |
Since the issue was labeled with `need reproduce`, but no response in 3 days. This issue will be closed. If you have any questions, you can comment and reply.

由于该 issue 被标记为需要复现,却 3 天未收到回应。现关闭 issue,若有任何问题,可评论回复。
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"eslint": "^8.2.0",
"husky": "^7.0.4",
"lint-staged": "^12.1.2",
"cpy-cli": "^5.0.0",
"prettier": "^2.5.0",
"pretty-quick": "^3.1.1",
"rimraf": "^3.0.2",
Expand Down
29 changes: 28 additions & 1 deletion packages/rc-cli/src/commands/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const DIST_FILE = join(ROOT, './changelog.generated.md');
const HEADER_TEMPLATE = join(__dirname, '../../template/changelog-header.hbs');
const MAIN_TEMPLATE = join(__dirname, '../../template/changelog-main.hbs');
const COMMIT_TEMPLATE = join(__dirname, '../../template/changelog-commit.hbs');
const CHANGELOG_MD = join(ROOT, './docs/markdown/changelog.zh-CN.md');

const mainTemplate = readFileSync(MAIN_TEMPLATE, 'utf-8');
const headerPartial = readFileSync(HEADER_TEMPLATE, 'utf-8');
Expand Down Expand Up @@ -58,6 +59,9 @@ export async function changelog(): Promise<void> {
preset: 'angular',
releaseCount: 2,
},
null,
null,
null,
{
mainTemplate,
headerPartial,
Expand All @@ -66,9 +70,32 @@ export async function changelog(): Promise<void> {
},
)
.pipe(createWriteStream(DIST_FILE))
.on('close', () => {
.on('close', async () => {
spinner.succeed(`Changelog generated at ${slimPath(DIST_FILE)}`);
await updateChangelog(spinner);
resolve();
});
});
}

async function updateChangelog(spinner: ora.Ora) {
fse.readFile(CHANGELOG_MD, (err, data) => {
if (err) throw err;

const content = data.toString();
const regex = /## 更新内容/g;
const match = regex.exec(content);
if (!match) {
console.log('未找到更新内容');
return;
}
const generatedText = readFileSync(DIST_FILE);
const insertIndex = match.index + match[0].length + 4;
const updatedContent =
content.slice(0, insertIndex) + generatedText + '\r\n' + content.slice(insertIndex);
fse.writeFile(CHANGELOG_MD, updatedContent, 'utf8', (err) => {
if (err) throw err;
spinner.succeed(`更新日志插入成功`);
});
});
}
38 changes: 29 additions & 9 deletions packages/rc-cli/template/changelog-commit.hbs
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
-
{{#if scope}}
{{scope}}:
{{~/if}}
{{#if subject}}
-{{#if scope}} {{scope}}:
{{~/if}} {{#if subject}}
{{~subject}}
{{~else}}
{{~header}}
{{~/if}}
{{#if references~}}
{{~#each references}}
[{{~this.repository}}#{{this.issue}}]({{~@root.repoUrl}}/{{~@root.issue}}/{{this.issue}}){{/each}}
{{~#each references}} [{{~this.repository}}#{{this.issue}}](
{{~#if @root.repository}}
{{~#if @root.host}}
{{~@root.host}}/
{{~/if}}
{{~#if @root.owner}}
{{~@root.owner}}/
{{~/if}}
{{~@root.repository}}
{{~else}}
{{~@root.repoUrl}}
{{~/if}}
/{{~@root.issue}}/{{this.issue}}){{/each}}
{{~else}} [{{shortHash}}](
{{~#if @root.repository}}
{{~#if @root.host}}
{{~@root.host}}/
{{~/if}}
{{~#if @root.owner}}
{{~@root.owner}}/
{{~/if}}
{{~@root.repository}}
{{~else}}
[{{shortHash}}]({{~@root.repoUrl}}/{{~@root.commit}}/{{hash}})
{{~/if}}
{{~@root.repoUrl}}
{{~/if}}
/{{~@root.commit}}/{{hash}})
{{~/if}}

16 changes: 15 additions & 1 deletion packages/rc-cli/template/changelog-header.hbs
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
### [v{{version}}]({{~@root.repoUrl}}/compare/{{previousTag}}...{{currentTag}}) `{{date}}`
### [v{{version}}](
{{~#if @root.repository}}
{{~#if @root.host}}
{{~@root.host}}/
{{~/if}}
{{~#if @root.owner}}
{{~@root.owner}}/
{{~/if}}
{{~@root.repository}}
{{~else}}
{{~@root.repoUrl}}
{{~/if}}
/compare/{{previousTag}}...{{currentTag}})

`{{date}}`
4 changes: 2 additions & 2 deletions packages/rc-ui-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"lint": "rc-cli lint",
"build": "rc-cli build",
"type": "tsc -p tsconfig.json",
"release": "cp ../../README.md ./ && rc-cli release && rm ./README.md",
"release": "cpy ../../README.md . --flat && rc-cli release && rimraf ./README.md",
"changelog": "rc-cli changelog",
"build:site": "rc-cli build-site",
"release:site": "pnpm build:site && gh-pages -d site",
Expand Down Expand Up @@ -82,4 +82,4 @@
"lib/**/style/*",
"*.less"
]
}
}
Loading