From 8045fbe13ae46a89265ffec98139747fb1a7ba4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gast=C3=B3n=20Fournier?= Date: Tue, 11 Feb 2025 15:56:40 +0100 Subject: [PATCH] chore: use gitcliff changelog for release (#9289) This is to reuse the gitcliff output for the release --- .github/workflows/publish-new-version.yaml | 30 +++++++++++++++++--- .github/workflows/release_changelog.yml | 32 ---------------------- 2 files changed, 26 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/release_changelog.yml diff --git a/.github/workflows/publish-new-version.yaml b/.github/workflows/publish-new-version.yaml index 71f672dd7a..f3035ce19c 100644 --- a/.github/workflows/publish-new-version.yaml +++ b/.github/workflows/publish-new-version.yaml @@ -27,7 +27,8 @@ on: jobs: build: runs-on: ubuntu-latest - + outputs: + changelog: ${{ steps.generate_changelog.outputs.changelog }} strategy: matrix: node-version: [ 20.x ] @@ -81,6 +82,19 @@ jobs: else echo "No changes to CHANGELOG.md" fi + - name: Output changelong from ${{ env.PREV }} + continue-on-error: true + id: generate_changelog + if: ${{ !contains(github.event.inputs.version, '-') }} + env: + PREV: ${{ env.PREV }} + run: | + # Run git-cliff again and capture its output in a variable + changelog=$(git-cliff $PREV..HEAD --tag v${{ github.event.inputs.version }}) + # Set the changelog as an output for the step using the new GITHUB_OUTPUT file + echo "changelog<> $GITHUB_OUTPUT + echo "$changelog" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT - run: yarn install --immutable env: YARN_ENABLE_SCRIPTS: false @@ -149,9 +163,17 @@ jobs: release-changelog: # TODO this changelog is different than the git-cliff one above needs: build - uses: ./.github/workflows/release_changelog.yml - with: - version: ${{ github.event.inputs.version }} + runs-on: ubuntu-latest + steps: + - name: Create release + uses: softprops/action-gh-release@v2 + with: + tag_name: v${{ inputs.version }} + name: v${{ inputs.version }} + body: ${{ needs.build.outputs.changelog }} + prerelease: ${{ contains(inputs.version, 'beta') || contains(inputs.version, 'alpha') }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} update-version-checker: needs: publish-docker diff --git a/.github/workflows/release_changelog.yml b/.github/workflows/release_changelog.yml deleted file mode 100644 index b1b7ee0f6d..0000000000 --- a/.github/workflows/release_changelog.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: 'Release changelog' -on: - workflow_call: - inputs: - version: - description: "Which version number should we use for the release" - type: 'string' - required: true - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: v${{ inputs.version }} # tag that should be created by the caller workflow - - name: Build changelog - id: github_release - uses: metcalfc/changelog-generator@v4.3.1 - with: - myToken: ${{ secrets.GITHUB_TOKEN }} - base-ref: v${{ inputs.version }} - - name: Create release - uses: softprops/action-gh-release@v2 - with: - tag_name: v${{ inputs.version }} - name: v${{ inputs.version }} - body: ${{ steps.github_release.outputs.changelog }} - prerelease: ${{ contains(inputs.version, 'beta') || contains(inputs.version, 'alpha') }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}