Skip to content

Commit

Permalink
get body from commit message (#350)
Browse files Browse the repository at this point in the history
* fix publish process

* extract correct changelog output

* update to 3.8.0

* try to get changes from commit message
  • Loading branch information
foxriver76 authored Jul 23, 2024
1 parent ef6e300 commit 7a5414e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ jobs:
const package = require('./package.json');
return package.version
- name: Extract the version and commit body from the tag
id: extract_release
# The body may be multiline, therefore we need to escape some characters
run: |
VERSION="${{ github.ref }}"
VERSION=${VERSION##*/v}
echo "::set-output name=VERSION::$VERSION"
BODY=$(git show -s --format=%b)
BODY="${BODY//'%'/'%25'}"
BODY="${BODY//$'\n'/'%0A'}"
BODY="${BODY//$'\r'/'%0D'}"
echo "::set-output name=BODY::$BODY"
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
Expand All @@ -69,7 +82,7 @@ jobs:
delete-branch: true
title: "[OFFICIAL RELEASE] ${{ steps.version.outputs.result }}"
body: |
Update version by release action
${{ steps.extract_release.outputs.BODY }}
labels: |
automated pr 🔧
assignees: foxriver76
Expand Down
31 changes: 14 additions & 17 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,18 @@ jobs:
npm whoami
npm publish
- name: Extract release notes
uses: actions/github-script@v7
id: changes
if: steps.automerge.outputs.mergeResult == 'merged'
with:
result-encoding: string
script: |
const fs = require('fs');
const changelogPlugin = require('@alcalzone/release-script-plugin-changelog');
const readme = fs.readFileSync('README.md', 'utf8');
const newestEntry = changelogPlugin.parseChangelogFile(readme, '###').entries[0];
const changes = newestEntry.split('\n').slice(1).join('\n').trim();
return changes;
- name: Extract the version and commit body from the tag
id: extract_release
# The body may be multiline, therefore we need to escape some characters
run: |
VERSION="${{ github.ref }}"
VERSION=${VERSION##*/v}
echo "::set-output name=VERSION::$VERSION"
BODY=$(git show -s --format=%b)
BODY="${BODY//'%'/'%25'}"
BODY="${BODY//$'\n'/'%0A'}"
BODY="${BODY//$'\r'/'%0D'}"
echo "::set-output name=BODY::$BODY"
- name: Create Github Release
if: steps.automerge.outputs.mergeResult == 'merged'
Expand All @@ -127,4 +123,5 @@ jobs:
name: Release v${{ steps.version.outputs.result }}
draft: false
prerelease: ${{ contains(steps.version.outputs.result, '-') }}
body: ${{ steps.changes.outputs.result }}
body: ${{ steps.extract_release.outputs.BODY }}

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,8 @@ The adapter is tested with an DENON AVR-X1200W and a Marantz SR5009.
Placeholder for the next version (at the beginning of the line):
### __WORK IN PROGRESS__
-->
### 1.15.8 (2024-07-23)
### __WORK IN PROGRESS__
* (foxriver76) updated dependencies
* (foxriver76) added tier and license information
* (foxriver76) fixed invalid object `denon.0`
Expand Down

0 comments on commit 7a5414e

Please sign in to comment.