A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.
fix(release): generate changelogs with GitHub release notes (#7121)
Thomasbab8e2a2dad8
diff --git a/.github/workflows/deployment-weekly-release.yml b/.github/workflows/deployment-weekly-release.ymlindex ecdec2460..1d340fa3e 100644--- a/.github/workflows/deployment-weekly-release.yml+++ b/.github/workflows/deployment-weekly-release.yml@@ -44,6 +44,26 @@ jobs:- name: No release neededif: ${{ steps.semver.outputs.bump == '' || steps.semver.outputs.bump == 'none' }}run: echo "No release-worthy commits were found since ${{ steps.semver.outputs.current }}." >> "$GITHUB_STEP_SUMMARY"+ - name: Generate release notes+ if: ${{ steps.semver.outputs.bump != '' && steps.semver.outputs.bump != 'none' }}+ env:+ GH_TOKEN: ${{ github.token }}+ CURRENT_VERSION: ${{ steps.semver.outputs.current }}+ NEXT_VERSION: ${{ steps.semver.outputs.next }}+ VERSION_BUMP: ${{ steps.semver.outputs.bump }}+ run: |+ gh api --method POST "repos/${GITHUB_REPOSITORY}/releases/generate-notes" \+ -f "tag_name=${NEXT_VERSION}" \+ -f "previous_tag_name=${CURRENT_VERSION}" \+ -f target_commitish=dev \+ --jq '.body' > "${RUNNER_TEMP}/release-notes.md"++ {+ printf '**This is an automatic release**.\n\n'+ printf 'Manual action may be required for major bumps.\n\n'+ printf 'Detected %s bump from `%s` to `%s`.\n\n' "$VERSION_BUMP" "$CURRENT_VERSION" "$NEXT_VERSION"+ cat "${RUNNER_TEMP}/release-notes.md"+ } > "${RUNNER_TEMP}/release-pr.md"- name: Create pull requestid: create-pull-requestif: ${{ steps.semver.outputs.bump != '' && steps.semver.outputs.bump != 'none' }}@@ -51,16 +71,21 @@ jobs:pr_url="$(gh pr list --base main --head dev --state open --json url --jq '.[0].url // empty')"if [[ -z "$pr_url" ]]; thenpr_url="$(gh pr create \- --title "chore(release): automatic release ${{ steps.semver.outputs.next }}" \- --body "**This is an automatic release**.<br/>Manual action may be required for major bumps.<br/>Detected change to be ``${{ steps.semver.outputs.bump }}``<br/>Bump version from ``${{ steps.semver.outputs.current }}`` to ``${{ steps.semver.outputs.next }}``" \+ --title "chore(release): automatic release ${NEXT_VERSION}" \+ --body-file "${RUNNER_TEMP}/release-pr.md" \--base main \--head dev \--label automerge)"+ else+ gh pr edit "$pr_url" \+ --title "chore(release): automatic release ${NEXT_VERSION}" \+ --body-file "${RUNNER_TEMP}/release-pr.md"fiecho "url=$pr_url" >> "$GITHUB_OUTPUT"echo "pr_number=${pr_url##*/}" >> "$GITHUB_OUTPUT"env:GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"+ NEXT_VERSION: ${{ steps.semver.outputs.next }}- name: Discord notificationif: ${{ steps.create-pull-request.outcome == 'success' && (github.event_name == 'schedule' || inputs.send-notifications) }}env:diff --git a/.releaserc.json b/.releaserc.jsonindex 5e26815ac..dc570525c 100644--- a/.releaserc.json+++ b/.releaserc.json@@ -18,12 +18,7 @@]}],- [- "@semantic-release/release-notes-generator",- {- "preset": "conventionalcommits"- }- ],+ "./scripts/release-notes.mjs",["@semantic-release/changelog",{diff --git a/scripts/release-notes.mjs b/scripts/release-notes.mjsnew file mode 100644index 000000000..056ad0f1a--- /dev/null+++ b/scripts/release-notes.mjs@@ -0,0 +1,28 @@+import { execFile } from "node:child_process";+import { promisify } from "node:util";++export async function generateNotes(_pluginConfig, { cwd, env, lastRelease, nextRelease }) {+ const argumentsList = [+ "api",+ "--method",+ "POST",+ `repos/${env.GITHUB_REPOSITORY}/releases/generate-notes`,+ "-f",+ `tag_name=${nextRelease.gitTag}`,+ "-f",+ `target_commitish=${nextRelease.gitHead}`,+ "--jq",+ ".body",+ ];++ if (lastRelease.gitTag) {+ argumentsList.push("-f", `previous_tag_name=${lastRelease.gitTag}`);+ }++ const { stdout } = await promisify(execFile)("gh", argumentsList, {+ cwd,+ env,+ maxBuffer: 1024 * 1024,+ });+ return stdout.trim();+}