feat(github): Update changelog workflow and config

This commit is contained in:
2023-05-22 17:52:43 +03:00
parent 65aaa4bec2
commit 0fdc9fd08a
4 changed files with 23 additions and 28 deletions

3
.actrc Normal file
View File

@@ -0,0 +1,3 @@
--container-architecture linux/amd64
--env-file .env
--secret-file .env

View File

@@ -13,13 +13,14 @@ module.exports = {
{ types: ['other', 'Other'], label: 'Other Changes' }, { types: ['other', 'Other'], label: 'Other Changes' },
], ],
excludeTypes: ['other'], excludeTypes: [],
renderTypeSection: function (label, commits) { renderTypeSection: function (label, commits) {
let text = `\n## ${ label }\n` let text = `\n## ${ label }\n\n`
commits.forEach((commit) => { commits.forEach((commit) => {
text += `- ${ commit.subject }\n` const scope = commit.scope ? `**${ commit.scope }:** ` : ''
text += `- ${ scope }${ commit.subject }\n`
}) })
return text return text
@@ -27,6 +28,8 @@ module.exports = {
renderChangelog: function (release, changes) { renderChangelog: function (release, changes) {
const now = new Date() const now = new Date()
return `# ${ release } - ${ now.toISOString().substring(0, 10) }\n` + changes + '\n\n' const d = now.toISOString().substring(0, 10);
const header = `# ${ release } - ${ d }\n`;
return header + changes + '\n\n'
}, },
} }

View File

@@ -15,7 +15,7 @@ jobs:
uses: loopwerk/tag-changelog@v1 uses: loopwerk/tag-changelog@v1
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
config_file: .github/tag-changelog-config.js config_file: ./../.github/tag-changelog-config.js
- name: "Echo results" - name: "Echo results"
id: output-changelog id: output-changelog

View File

@@ -18,34 +18,23 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 # Checkout our working repository - uses: actions/checkout@v3 # Checkout our working repository
- uses: fregante/daily-version-action@v2 - name: Create tag if necessary
name: Create tag if necessary uses: fregante/daily-version-action@v2
id: daily-version id: daily-version
- name: Conventional Changelog Action - name: Create changelog text
if: steps.daily-version.outputs.created if: steps.daily-version.outputs.created
id: changelog id: changelog
uses: TriPSs/conventional-changelog-action@v3 uses: loopwerk/tag-changelog@v1
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
skip-git-pull: "true" config_file: ./../.github/tag-changelog-config.js
output-file: "false"
fallback-version: "${{ steps.daily-version.outputs.version }}"
skip-version-file: "true"
git-message: "chore(release): {version}"
git-user-name: "${{ github.actor }}"
git-user-email: "${{ github.actor }}@users.noreply.github.com"
- name: Create release - name: Create release
if: env.DAILY_VERSION_CREATED uses: actions/create-release@latest
uses: actions/github-script@v6.4.1 env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} tag_name: ${{ steps.daily-version.outputs.version }}
script: | release_name: Release ${{ steps.daily-version.outputs.version }}
await github.request( body: ${{ steps.changelog.outputs.changes }}
`POST /repos/${{ github.repository }}/releases`,
{
tag_name: "${{ steps.daily-version.outputs.version }}",
body: "${{ steps.daily-version.outputs.clean_changelog }}"
}
);