From 821d68a2f8675b3b1d98756e479748cb2ed9eb0d Mon Sep 17 00:00:00 2001 From: Brandon Smith Date: Tue, 29 Oct 2024 12:55:13 -0700 Subject: [PATCH] fix(ci): workflows. --- .github/workflows/addon-release.yaml | 5 ++--- .github/workflows/untagged.yaml | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/addon-release.yaml b/.github/workflows/addon-release.yaml index d83a5a6..dc8e370 100644 --- a/.github/workflows/addon-release.yaml +++ b/.github/workflows/addon-release.yaml @@ -3,9 +3,8 @@ name: Build and Release Addon on: workflow_dispatch: pull_request: - push: - tags: - - '**' + release: + types: [published, created, edited, deleted, prereleased, released] jobs: build: diff --git a/.github/workflows/untagged.yaml b/.github/workflows/untagged.yaml index cf77f5c..7af0167 100644 --- a/.github/workflows/untagged.yaml +++ b/.github/workflows/untagged.yaml @@ -90,4 +90,22 @@ jobs: git push origin HEAD:${{ github.ref }} # Create a new tag for the release git tag -a "v$NEW_VERSION" -m "Release version $NEW_VERSION" -m "$$CHANGELOG_NEWLINES" - git push origin "v$NEW_VERSION" \ No newline at end of file + git push origin "v$NEW_VERSION" + + - name: Create Release Draft + if: ${{ steps.get_version.outputs.nextRelease != '' }} + env: + NEXT_RELEASE: ${{ steps.get_version.outputs.nextRelease }} + run: | + # Extract the next version and changelog notes from the output + NEW_VERSION=$(echo $NEXT_RELEASE | jq -r '.version') + CHANGELOG=$(echo $NEXT_RELEASE | jq -r '.notes') + + # Update the Changelog to handle the new lines. + CHANGELOG_NEWLINES=$(echo -e "$CHANGELOG") + + # Create the release draft + echo "Creating release draft for v$NEW_VERSION" + echo "Changelog: $CHANGELOG" + echo "Changelog with newlines: $CHANGELOG_NEWLINES" + gh release create "v$NEW_VERSION" --title "v$NEW_VERSION" --notes "$CHANGELOG_NEWLINES" --draft \ No newline at end of file