Skip to content

Commit e827319

Browse files
committed
GitHub Actions: simplify changelog handling
1 parent 3eb0c48 commit e827319

File tree

3 files changed

+15
-40
lines changed

3 files changed

+15
-40
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ jobs:
3030
build:
3131
name: Build
3232
runs-on: ubuntu-latest
33-
outputs:
34-
version: ${{ steps.properties.outputs.version }}
35-
changelog: ${{ steps.properties.outputs.changelog }}
3633
steps:
3734

3835
# Free GitHub Actions Environment Disk Space
@@ -57,20 +54,6 @@ jobs:
5754
- name: Setup Gradle
5855
uses: gradle/actions/setup-gradle@v4
5956

60-
# Set environment variables
61-
- name: Export Properties
62-
id: properties
63-
shell: bash
64-
run: |
65-
PROPERTIES="$(./gradlew properties --console=plain -q)"
66-
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
67-
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
68-
69-
echo "version=$VERSION" >> $GITHUB_OUTPUT
70-
echo "changelog<<EOF" >> $GITHUB_OUTPUT
71-
echo "$CHANGELOG" >> $GITHUB_OUTPUT
72-
echo "EOF" >> $GITHUB_OUTPUT
73-
7457
# Build plugin
7558
- name: Build plugin
7659
run: ./gradlew buildPlugin
@@ -253,10 +236,11 @@ jobs:
253236
env:
254237
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
255238
run: |
256-
gh release create "v${{ needs.build.outputs.version }}" \
239+
VERSION=$(./gradlew properties --property version --quiet --console=plain | tail -n 1 | cut -f2- -d ' ')
240+
RELEASE_NOTE="./build/tmp/release_note.txt"
241+
./gradlew getChangelog --unreleased --no-header --quiet --console=plain --output-file=$RELEASE_NOTE
242+
243+
gh release create $VERSION \
257244
--draft \
258-
--title "v${{ needs.build.outputs.version }}" \
259-
--notes "$(cat << 'EOM'
260-
${{ needs.build.outputs.changelog }}
261-
EOM
262-
)"
245+
--title $VERSION \
246+
--notes-file $RELEASE_NOTE

.github/workflows/release.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,17 @@ jobs:
4444
with:
4545
cache-read-only: true
4646

47-
# Set environment variables
48-
- name: Export Properties
49-
id: properties
50-
shell: bash
51-
run: |
52-
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
53-
${{ github.event.release.body }}
54-
EOM
55-
)"
56-
57-
echo "changelog<<EOF" >> $GITHUB_OUTPUT
58-
echo "$CHANGELOG" >> $GITHUB_OUTPUT
59-
echo "EOF" >> $GITHUB_OUTPUT
60-
6147
# Update the Unreleased section with the current release note
6248
- name: Patch Changelog
63-
if: ${{ steps.properties.outputs.changelog != '' }}
49+
if: ${{ github.event.release.body != '' }}
6450
env:
65-
CHANGELOG: ${{ steps.properties.outputs.changelog }}
51+
CHANGELOG: ${{ github.event.release.body }}
6652
run: |
67-
./gradlew patchChangelog --release-note="$CHANGELOG"
53+
RELEASE_NOTE="./build/tmp/release_note.txt"
54+
echo "$CHANGELOG" > $RELEASE_NOTE
55+
56+
${{ github.event.release.body }}
57+
./gradlew patchChangelog --release-note-file=$RELEASE_NOTE
6858
6959
# Publish the plugin to JetBrains Marketplace
7060
- name: Publish Plugin

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Changed
1212

13+
- GitHub Actions: simplify changelog handling
1314
- Dependencies - upgrade `org.jetbrains.changelog` to `2.4.0`
1415

1516
## [2.2.0] - 2025-08-05

0 commit comments

Comments
 (0)