Skip to content

Commit ea1a413

Browse files
committed
feat: Add GH worklows
1 parent a76b91c commit ea1a413

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

.github/tag-changelog-config.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
types: [
3+
{ types: ["feat", "feature"], label: "✨ New Features" },
4+
{ types: ["fix", "bugfix"], label: "🐛 Bugfixes" },
5+
{ types: ["improvements", "enhancement"], label: "🔨 Improvements" },
6+
{ types: ["perf"], label: "🏎️ Performance Improvements" },
7+
{ types: ["build", "ci"], label: "🏗️ Build System" },
8+
{ types: ["refactor"], label: "🪚 Refactors" },
9+
{ types: ["doc", "docs"], label: "📚 Documentation Changes" },
10+
{ types: ["test", "tests"], label: "🔍 Tests" },
11+
{ types: ["style"], label: "💅 Code Style Changes" },
12+
{ types: ["chore"], label: "🧹 Chores" },
13+
{ types: ["other"], label: "Other Changes" },
14+
],
15+
16+
excludeTypes: ["other"],
17+
18+
renderTypeSection: function (label, commits) {
19+
let text = `\n## ${label}\n`;
20+
commits.forEach((commit) => {
21+
const scope = commit.scope ? `**${commit.scope}**: ` : ''
22+
text += `- [\`${commit.sha.substring(0, 7)}\`](${commit.url}) ${scope} ${commit.subject}\n`;
23+
});
24+
return text;
25+
},
26+
27+
renderChangelog: function (release, changes) {
28+
const now = new Date();
29+
return `# ${release} - ${now.toISOString().substr(0, 10)}\n` + changes + "\n\n";
30+
},
31+
};

.github/workflows/release.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Worshop Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
build-upload-release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Get version from tag
15+
id: version
16+
run: echo ::set-output name=number::$(echo $GITHUB_REF | cut -d / -f 3 | cut -d / -f 3 | sed -e 's/^v//')
17+
18+
- name: Create changelog text
19+
id: changelog
20+
uses: loopwerk/tag-changelog@v1
21+
with:
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
exclude_types: other,doc,chore
24+
config_file: .github/tag-changelog-config.js
25+
26+
- name: Parse changelog markdown to HTML
27+
id: changelog-html
28+
uses: lifepal/[email protected]
29+
with:
30+
text: ${{ steps.changelog.outputs.changelog }}
31+
32+
- name: Release to GitHub releasesc
33+
uses: softprops/action-gh-release@v1
34+
with:
35+
body: ${{ steps.changelog.outputs.changes }}
36+
fail_on_unmatched_files: true
37+
tag_name: ${{ steps.version.outputs.number }}

0 commit comments

Comments
 (0)