GitHub Actions: simplify changelog handling

This commit is contained in:
Jakub Chrzanowski 2025-08-05 11:56:45 +02:00
parent 3eb0c4832a
commit e827319b92
3 changed files with 15 additions and 40 deletions

View File

@ -30,9 +30,6 @@ jobs:
build: build:
name: Build name: Build
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
steps: steps:
# Free GitHub Actions Environment Disk Space # Free GitHub Actions Environment Disk Space
@ -57,20 +54,6 @@ jobs:
- name: Setup Gradle - name: Setup Gradle
uses: gradle/actions/setup-gradle@v4 uses: gradle/actions/setup-gradle@v4
# Set environment variables
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Build plugin # Build plugin
- name: Build plugin - name: Build plugin
run: ./gradlew buildPlugin run: ./gradlew buildPlugin
@ -253,10 +236,11 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
gh release create "v${{ needs.build.outputs.version }}" \ VERSION=$(./gradlew properties --property version --quiet --console=plain | tail -n 1 | cut -f2- -d ' ')
RELEASE_NOTE="./build/tmp/release_note.txt"
./gradlew getChangelog --unreleased --no-header --quiet --console=plain --output-file=$RELEASE_NOTE
gh release create $VERSION \
--draft \ --draft \
--title "v${{ needs.build.outputs.version }}" \ --title $VERSION \
--notes "$(cat << 'EOM' --notes-file $RELEASE_NOTE
${{ needs.build.outputs.changelog }}
EOM
)"

View File

@ -44,27 +44,17 @@ jobs:
with: with:
cache-read-only: true cache-read-only: true
# Set environment variables
- name: Export Properties
id: properties
shell: bash
run: |
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
${{ github.event.release.body }}
EOM
)"
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Update the Unreleased section with the current release note # Update the Unreleased section with the current release note
- name: Patch Changelog - name: Patch Changelog
if: ${{ steps.properties.outputs.changelog != '' }} if: ${{ github.event.release.body != '' }}
env: env:
CHANGELOG: ${{ steps.properties.outputs.changelog }} CHANGELOG: ${{ github.event.release.body }}
run: | run: |
./gradlew patchChangelog --release-note="$CHANGELOG" RELEASE_NOTE="./build/tmp/release_note.txt"
echo "$CHANGELOG" > $RELEASE_NOTE
${{ github.event.release.body }}
./gradlew patchChangelog --release-note-file=$RELEASE_NOTE
# Publish the plugin to JetBrains Marketplace # Publish the plugin to JetBrains Marketplace
- name: Publish Plugin - name: Publish Plugin

View File

@ -10,6 +10,7 @@
### Changed ### Changed
- GitHub Actions: simplify changelog handling
- Dependencies - upgrade `org.jetbrains.changelog` to `2.4.0` - Dependencies - upgrade `org.jetbrains.changelog` to `2.4.0`
## [2.2.0] - 2025-08-05 ## [2.2.0] - 2025-08-05