From 01f42feae52028697668bb7c6c190b5dad4a4aec Mon Sep 17 00:00:00 2001 From: Antonio Fernandez Alhambra Date: Sat, 23 Mar 2024 23:35:23 +0100 Subject: [PATCH] Create new workflow for Platform Chart --- .../release-changelog-builder-action.yaml | 81 +++++++++---------- 1 file changed, 38 insertions(+), 43 deletions(-) diff --git a/.github/workflows/release-changelog-builder-action.yaml b/.github/workflows/release-changelog-builder-action.yaml index e34d208d..796efebc 100644 --- a/.github/workflows/release-changelog-builder-action.yaml +++ b/.github/workflows/release-changelog-builder-action.yaml @@ -10,46 +10,10 @@ env: PLATFORM_CHART_PATH: charts/hivemq-platform jobs: - generate-release-notes: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2 - with: - fetch-depth: 0 - - - name: Fetch latest and previous tags - id: fetch-latest-previous-tags - run: | - set -x - # Fetch latest and previous tag - tags=($(git tag --list "hivemq-platform-[0-9]*.[0-9]*.[0-9]*" | sort -r | head -n 2)) - echo "latest_tag=${tags[0]}" >> "$GITHUB_OUTPUT" - echo "previous_tag=${tags[1]}" >> "$GITHUB_OUTPUT" - - - name: Generate release notes for the released charts - id: generate-release-notes - uses: mikepenz/release-changelog-builder-action@v4.2.0 - with: - ignorePreReleases: true - fromTag: ${{ steps.fetch-latest-previous-tags.outputs.latest_tag }} - path: ${{ env.PLATFORM_CHART_PATH }} - outputFile: RELEASE_NOTES.md - env: - GH_TOKEN: ${{ github.token }} - - - name: Stash generated release notes - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - name: charts-generated-release-notes - path: | - ${{ env.PLATFORM_CHART_PATH }}/RELEASE_NOTES.md - release-charts: permissions: contents: write # to push chart release and create a release (helm/chart-releaser-action) runs-on: ubuntu-latest - needs: generate-release-notes steps: - name: Checkout Code uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 @@ -62,12 +26,6 @@ jobs: git config user.name "$GITHUB_ACTOR" git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - name: Unstash generated release notes - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 - with: - name: charts-generated-release-notes - path: ${{ env.PLATFORM_CHART_PATH }} - - name: Set up Helm uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5 with: @@ -84,4 +42,41 @@ jobs: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" with: mark_as_latest: false - release-notes-file: RELEASE-NOTES.md + + generate-release-notes: + runs-on: ubuntu-latest + needs: release-charts + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2 + with: + fetch-depth: 0 + + - name: Fetch latest and previous tags + id: fetch-latest-previous-tags + run: | + set -x + # Fetch latest and previous tag + tags=($(git tag --list "hivemq-platform-[0-9]*.[0-9]*.[0-9]*" | sort -r | head -n 2)) + echo "latest_tag=${tags[0]}" >> "$GITHUB_OUTPUT" + echo "previous_tag=${tags[1]}" >> "$GITHUB_OUTPUT" + + - name: Generate release notes + id: generate-release-notes + uses: mikepenz/release-changelog-builder-action@v4.2.0 + with: + ignorePreReleases: true + fromTag: ${{ steps.fetch-latest-previous-tags.outputs.latest_tag }} + path: ${{ env.PLATFORM_CHART_PATH }} + outputFile: RELEASE_NOTES.md + env: + GH_TOKEN: ${{ github.token }} + + - name: Update release notes + env: + GH_TOKEN: ${{ github.token }} + run: | + set -x + + latest_tag="${{ steps.fetch-latest-previous-tags.outputs.latest_tag }}" + gh release edit ${latest_tag} --notes-file ${{ env.PLATFORM_CHART_PATH }}/RELEASE_NOTES.md