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

View File

@@ -13,13 +13,14 @@ module.exports = {
{ types: ['other', 'Other'], label: 'Other Changes' },
],
excludeTypes: ['other'],
excludeTypes: [],
renderTypeSection: function (label, commits) {
let text = `\n## ${ label }\n`
let text = `\n## ${ label }\n\n`
commits.forEach((commit) => {
text += `- ${ commit.subject }\n`
const scope = commit.scope ? `**${ commit.scope }:** ` : ''
text += `- ${ scope }${ commit.subject }\n`
})
return text
@@ -27,6 +28,8 @@ module.exports = {
renderChangelog: function (release, changes) {
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
with:
token: ${{ secrets.GITHUB_TOKEN }}
config_file: .github/tag-changelog-config.js
config_file: ./../.github/tag-changelog-config.js
- name: "Echo results"
id: output-changelog

View File

@@ -18,34 +18,23 @@ jobs:
steps:
- 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
- name: Conventional Changelog Action
- name: Create changelog text
if: steps.daily-version.outputs.created
id: changelog
uses: TriPSs/conventional-changelog-action@v3
uses: loopwerk/tag-changelog@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-git-pull: "true"
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"
token: ${{ secrets.GITHUB_TOKEN }}
config_file: ./../.github/tag-changelog-config.js
- name: Create release
if: env.DAILY_VERSION_CREATED
uses: actions/github-script@v6.4.1
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.request(
`POST /repos/${{ github.repository }}/releases`,
{
tag_name: "${{ steps.daily-version.outputs.version }}",
body: "${{ steps.daily-version.outputs.clean_changelog }}"
}
);
tag_name: ${{ steps.daily-version.outputs.version }}
release_name: Release ${{ steps.daily-version.outputs.version }}
body: ${{ steps.changelog.outputs.changes }}