Skip to content

Commit

Permalink
feat(workflow): Add GH release
Browse files Browse the repository at this point in the history
  • Loading branch information
embesozzi committed Nov 7, 2023
1 parent 36e6003 commit 206fe7a
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/tag-changelog-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
types: [
{ types: ["feat", "feature"], label: "✨ New Features" },
{ types: ["fix", "bugfix"], label: "🐛 Bugfixes" },
{ types: ["improvements", "enhancement"], label: "🔨 Improvements" },
{ types: ["perf"], label: "🏎️ Performance Improvements" },
{ types: ["build", "ci"], label: "🏗️ Build System" },
{ types: ["refactor"], label: "🪚 Refactors" },
{ types: ["doc", "docs"], label: "📚 Documentation Changes" },
{ types: ["test", "tests"], label: "🔍 Tests" },
{ types: ["style"], label: "💅 Code Style Changes" },
{ types: ["chore"], label: "🧹 Chores" },
{ types: ["other"], label: "Other Changes" },
],

excludeTypes: ["other"],

renderTypeSection: function (label, commits) {
let text = `\n## ${label}\n`;
commits.forEach((commit) => {
const scope = commit.scope ? `**${commit.scope}**: ` : ''
text += `- [\`${commit.sha.substring(0, 7)}\`](${commit.url}) ${scope} ${commit.subject}\n`;
});
return text;
},

renderChangelog: function (release, changes) {
const now = new Date();
return `# ${release} - ${now.toISOString().substr(0, 10)}\n` + changes + "\n\n";
},
};
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Worshop Release

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
build-upload-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Get version from tag
id: version
run: echo ::set-output name=number::$(echo $GITHUB_REF | cut -d / -f 3 | cut -d / -f 3 | sed -e 's/^v//')

- name: Create changelog text
id: changelog
uses: loopwerk/tag-changelog@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
exclude_types: other,doc,chore
config_file: .github/tag-changelog-config.js

- name: Parse changelog markdown to HTML
id: changelog-html
uses: lifepal/[email protected]
with:
text: ${{ steps.changelog.outputs.changelog }}

- name: Release to GitHub releasesc
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.changelog.outputs.changes }}
fail_on_unmatched_files: true
tag_name: ${{ steps.version.outputs.number }}

0 comments on commit 206fe7a

Please sign in to comment.