Skip to content

Fixed body parameter in the release workflow (#26) #19

Fixed body parameter in the release workflow (#26)

Fixed body parameter in the release workflow (#26) #19

Workflow file for this run

name: Create Github Release
on:
push:
branches:
- main
jobs:
CheckVersion:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get current version
id: get_version
run: |
echo "version=$(grep -oP '\K\d+\.\d+\.\d+' version.rb)" >> $GITHUB_OUTPUT
- name: Get previous version
id: get_previous_version
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version number
id: extract_version
run: |
version=${{ steps.get_previous_version.outputs.release }}
version=${version#v}
echo "version=$version" >> $GITHUB_OUTPUT
shell: bash
- name: Check if version changed
id: check_version
run: |
if [ -n "${{ steps.extract_version.outputs.version }}" ] && [ "${{ steps.get_version.outputs.version }}" != "${{ steps.extract_version.outputs.version }}" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
shell: bash
outputs:
versionChanged: ${{ steps.check_version.outputs.changed }}
newVersion: ${{ steps.get_version.outputs.version }}
CreateRelease:
needs: CheckVersion
if: needs.CheckVersion.outputs.versionChanged == 'true'
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Release notes
run: |
echo "## What's Changed
" > RELEASE_NOTES.md
sed -n '/<!--Releasenotes start-->/,/<!--Releasenotes end-->/p' CHANGELOG.md >> RELEASE_NOTES.md
echo "
**[Full Changelog](CHANGELOG.md)**" >> RELEASE_NOTES.md
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ needs.CheckVersion.outputs.newVersion }}
name: v${{ needs.CheckVersion.outputs.newVersion }}
body_path: RELEASE_NOTES.md
- name: Dispatch repository event
uses: octokit/request-action@v2.x
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
route: POST /repos/{owner}/{repo}/dispatches
owner: ${{ github.repository_owner }}
repo: ${{ github.repository }}
event_type: release_created