bazzite/.github/workflows/generate_release.yml
Antheas Kapenekakis 34c51f16a1
feat: add automatically generated changelogs (#1767)
* feat: add automatically generated changelogs

* fix changelog header by not removing unstable-

* fix: add dispatch settings

* fix remove defaults from target to run on ref if not provided

* fix add missing echo

* fix: fix changelog path

* fix: tweak input branch name

* fix: add debug logs

* fix: fix setting env vars in action

* fix: var name syntax

* fix: use github output instead

* fix: use tag name

* fix: add workflow tag trigger

* feat: add changelog option + small note to hide ugly preview

* chore: simplify changelog description

* fix: add more filler text to avoid preview breaking

* fix: tweak filler text
2024-10-25 10:30:57 -07:00

44 lines
1.4 KiB
YAML

on:
workflow_call:
workflow_dispatch:
inputs:
handwritten:
description: 'Small changelog about changes in this build:'
target:
description: 'Release Branch (e.g., testing). Defaults to branch name.'
permissions:
contents: write
name: Generate Release
jobs:
generate-release:
runs-on: ubuntu-latest
steps:
- name: Checkout last 500 commits (for <commits> to work)
uses: actions/checkout@v4
with:
fetch-depth: 500
- name: Get target
id: get-target
run: |
echo "target=${{ github.event.inputs.target || github.ref }}" > $GITHUB_OUTPUT
- name: Generate Release Text
id: generate-release
run: |
python3 ./.github/workflows/changelog.py \
"${{ steps.get-target.outputs.target }}" \
./output.env ./changelog.md --workdir . --handwritten "${{ github.event.inputs.handwritten }}"
source ./output.env
echo "title=${TITLE}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.generate-release.outputs.title }}
tag_name: ${{ steps.generate-release.outputs.tag }}
body_path: ./changelog.md
make_latest: ${{ steps.get-target.outputs.target == 'stable' }}
prerelease: ${{ steps.get-target.outputs.target != 'stable' }}