gha-workflows/.github/workflows/create-release.yml

53 lines
1.8 KiB
YAML
Raw Permalink Normal View History

name: Create Release
on:
workflow_call:
2024-07-13 13:20:05 +02:00
outputs:
release_name:
description: "Name of the created release"
value: ${{ jobs.create_release.outputs.release_name }}
2024-07-16 20:02:55 +02:00
success:
description: "Was the release created successfully?"
value: ${{ jobs.create_release.outputs.success }}
jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
outputs:
2024-07-13 13:20:05 +02:00
release_name: ${{ steps.tag_version.outputs.new_tag }}
2024-07-16 20:02:55 +02:00
success: ${{ steps.set_flag.outputs.success }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Changes since last tag
id: changes
2024-07-15 21:55:57 +02:00
run: |
2024-07-15 21:57:01 +02:00
CHANGES=$(git log $(git describe --tags --abbrev=0)..HEAD --no-merges --oneline)
2024-07-15 22:01:09 +02:00
echo "$CHANGES"
if [ -z "$CHANGES" ]; then echo "changes=false" >> "$GITHUB_OUTPUT"; else echo "changes=true" >> "$GITHUB_OUTPUT"; fi
- name: Bump version and push tag
id: tag_version
if: steps.changes.outputs.changes == 'true'
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
2024-07-15 22:02:54 +02:00
default_bump: minor
# default_bump: false
- name: Create a GitHub release
if: steps.changes.outputs.changes == 'true'
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
generateReleaseNotes: true
2024-07-16 20:02:55 +02:00
2024-07-16 20:07:38 +02:00
- name: Set success/fail flag
2024-07-16 20:02:55 +02:00
id: set_flag
2024-07-16 20:07:38 +02:00
if: steps.changes.outputs.changes == 'true'
run: if test "${{ steps.changes.outputs.changes }}" = "true"; then echo "success=true" >> "$GITHUB_OUTPUT"; else echo "success=false" >> "$GITHUB_OUTPUT"; fi