Skip to content

Commit 8045fbe

Browse files
chore: use gitcliff changelog for release (#9289)
This is to reuse the gitcliff output for the release
1 parent 140290a commit 8045fbe

File tree

2 files changed

+26
-36
lines changed

2 files changed

+26
-36
lines changed

.github/workflows/publish-new-version.yaml

+26-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ on:
2727
jobs:
2828
build:
2929
runs-on: ubuntu-latest
30-
30+
outputs:
31+
changelog: ${{ steps.generate_changelog.outputs.changelog }}
3132
strategy:
3233
matrix:
3334
node-version: [ 20.x ]
@@ -81,6 +82,19 @@ jobs:
8182
else
8283
echo "No changes to CHANGELOG.md"
8384
fi
85+
- name: Output changelong from ${{ env.PREV }}
86+
continue-on-error: true
87+
id: generate_changelog
88+
if: ${{ !contains(github.event.inputs.version, '-') }}
89+
env:
90+
PREV: ${{ env.PREV }}
91+
run: |
92+
# Run git-cliff again and capture its output in a variable
93+
changelog=$(git-cliff $PREV..HEAD --tag v${{ github.event.inputs.version }})
94+
# Set the changelog as an output for the step using the new GITHUB_OUTPUT file
95+
echo "changelog<<EOF" >> $GITHUB_OUTPUT
96+
echo "$changelog" >> $GITHUB_OUTPUT
97+
echo "EOF" >> $GITHUB_OUTPUT
8498
- run: yarn install --immutable
8599
env:
86100
YARN_ENABLE_SCRIPTS: false
@@ -149,9 +163,17 @@ jobs:
149163

150164
release-changelog: # TODO this changelog is different than the git-cliff one above
151165
needs: build
152-
uses: ./.github/workflows/release_changelog.yml
153-
with:
154-
version: ${{ github.event.inputs.version }}
166+
runs-on: ubuntu-latest
167+
steps:
168+
- name: Create release
169+
uses: softprops/action-gh-release@v2
170+
with:
171+
tag_name: v${{ inputs.version }}
172+
name: v${{ inputs.version }}
173+
body: ${{ needs.build.outputs.changelog }}
174+
prerelease: ${{ contains(inputs.version, 'beta') || contains(inputs.version, 'alpha') }}
175+
env:
176+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
155177

156178
update-version-checker:
157179
needs: publish-docker

.github/workflows/release_changelog.yml

-32
This file was deleted.

0 commit comments

Comments
 (0)