Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

build: release changelog (#3679)

Bogdan Chadkin7073cd9a1607
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 1a3cc201c5..3ef4eb05b0 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -11,16 +11,49 @@ jobs:
permissions:
contents: write
steps:
- - uses: ardalanamini/auto-changelog@v4
- id: changelog
+ - uses: actions/github-script@v7
with:
- commit-types: |
- feat: Features
- fix: Fixes
- docs: Documentation
- experimental: Experimental
+ script: |
+ const latestRelease = await github.rest.repos.getLatestRelease({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ })
+ const commits = await github.rest.repos.compareCommitsWithBasehead({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ basehead: `refs/tags/${latestRelease.data.tag_name}...${context.ref}`,
+ })
- - uses: ncipollo/release-action@v1
- with:
- body: |
- ${{ steps.changelog.outputs.changelog }}
+ const groups = {
+ feat: [`## Features\n`],
+ fix: [`## Fixes\n`],
+ docs: [`## Documentation\n`],
+ experimental: [`## Experimental\n`],
+ other: [`## Other changes\n`],
+ }
+ for (const commit of commits.data.commits) {
+ const match = commit.commit.message.match(/^(?<type>\w+)\s*:\s*(?<message>.+)\n*/)
+ const type = match?.groups?.type
+ const message = match?.groups?.message
+ if (type && message) {
+ const availableType = type in groups ? type : 'other'
+ const capitalized = message[0].toLocaleUpperCase() + message.slice(1)
+ groups[availableType].push(`- ${capitalized} by @${commit.author.login}`)
+ }
+ }
+
+ const tag_name = context.ref.slice('refs/tags/'.length)
+ const fullChangelog = `**Full Changelog**: https://github.com/${context.repo.owner}/${context.repo.repo}/compare/${latestRelease.data.tag_name}...${tag_name}`
+ const changelog = Object.values(groups)
+ .filter(lines => lines.length > 1)
+ .map(lines => lines.join('\n'))
+ .concat(fullChangelog)
+ .join('\n\n')
+ console.info(changelog)
+
+ await github.rest.repos.createRelease({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ tag_name,
+ body: changelog,
+ })