-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Added automatic draft release and changelog updater (#23)
- Loading branch information
1 parent
c67354b
commit 65c0900
Showing
4 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name-template: '$RESOLVED_VERSION' | ||
tag-template: '$RESOLVED_VERSION' | ||
categories: | ||
- title: '🚀 Features' | ||
labels: | ||
- 'feature' | ||
- 'enhancement' | ||
- title: '🐛 Bug Fixes' | ||
labels: | ||
- 'fix' | ||
- 'bugfix' | ||
- 'bug' | ||
- title: '🧰 Maintenance' | ||
label: 'chore' | ||
change-template: '- $TITLE @$AUTHOR (#$NUMBER)' | ||
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. | ||
version-resolver: | ||
major: | ||
labels: | ||
- 'major' | ||
minor: | ||
labels: | ||
- 'minor' | ||
patch: | ||
labels: | ||
- 'patch' | ||
default: patch | ||
template: | | ||
## What’s Changed | ||
$CHANGES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module.exports = { | ||
types: [ | ||
{ types: ["feat", "feature"], label: "🎉 New Features" }, | ||
{ types: ["fix", "bugfix", "bug"], 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) => { | ||
text += `- ${commit.subject}\n`; | ||
}); | ||
|
||
return text; | ||
}, | ||
|
||
renderChangelog: function (release, changes) { | ||
const now = new Date(); | ||
return `## ${release} - ${now.toISOString().substr(0, 10)}\n` + changes + "\n\n"; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Generate Changelog | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
update_changelog: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
output: ${{ steps.changelog.outputs.changelog }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: main | ||
- name: Generate Changelog | ||
id: changelog | ||
uses: loopwerk/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
exclude_types: other,doc,chore | ||
config_file: .github/tag-changelog-config.js | ||
- name: Output Changelog | ||
id: output_changelog | ||
run: TAGCONTENT="${{ steps.changelog.outputs.changelog }}";CHANGELOG=$(cat CHANGELOG.md);CHANGELOG=$(echo "$CHANGELOG" | sed -e "s/# Changelog//");echo -e "# Changelog\n\n$TAGCONTENT$CHANGELOG" > CHANGELOG.md | ||
- name: Commit Updated Changelog | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Updated CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Release Drafter | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
update_release_draft: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Draft Release | ||
uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |