Add results to the run summary, new multiline comments option (#37) #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |