feat(actions): add post-step support for composite actions
This commit is contained in:
98
action.yml
98
action.yml
@@ -1,66 +1,46 @@
|
||||
name: Auto Changelog & Release
|
||||
description: "One-stop composite action for version-bump detection, changelog generation and Gitea release."
|
||||
name: "Auto Changelog & Release"
|
||||
description: "Detects version bump and, in post-step, writes changelog or publishes release."
|
||||
|
||||
inputs:
|
||||
token:
|
||||
description: "Gitea/GitHub PAT für Release-API"
|
||||
required: false
|
||||
default: ""
|
||||
author_name:
|
||||
description: "Commit-Autorname"
|
||||
required: false
|
||||
default: ""
|
||||
author_email:
|
||||
description: "Commit-Autore-Mail"
|
||||
required: false
|
||||
default: ""
|
||||
token: { description: "Gitea/GitHub PAT", default: "" }
|
||||
author_name: { description: "Commit author", default: "" }
|
||||
author_email: { description: "Commit e-mail", default: "" }
|
||||
allow_non_main_release:
|
||||
description: "Allow publishing releases from branches other than 'main'."
|
||||
required: false
|
||||
description: "Allow release on branches ≠ main"
|
||||
default: "false"
|
||||
|
||||
outputs:
|
||||
release:
|
||||
description: "true if VERSION changed"
|
||||
value: ${{ steps.detect.outputs.version_changed }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
using: composite
|
||||
steps:
|
||||
- name: Detect version change
|
||||
shell: bash
|
||||
id: detect
|
||||
env:
|
||||
GITHUB_EVENT_BEFORE: ${{ github.event.before || '' }}
|
||||
GITHUB_SHA: ${{ github.sha || '' }}
|
||||
GITHUB_REF: ${{ github.ref || '' }}
|
||||
ALLOW_NON_MAIN_RELEASE: ${{ inputs.allow_non_main_release }}
|
||||
run: |
|
||||
${{ github.action_path }}/scripts/detect-version-change.sh
|
||||
|
||||
- name: Read CLIFF_VERSION
|
||||
shell: bash
|
||||
id: cliff_version
|
||||
run: |
|
||||
${{ github.action_path }}/scripts/read-cliff-version.sh
|
||||
|
||||
- name: Install git-cliff
|
||||
shell: bash
|
||||
run: |
|
||||
${{ github.action_path }}/scripts/install-git-cliff.sh "${{ steps.cliff_version.outputs.version }}"
|
||||
|
||||
- name: Set up git
|
||||
shell: bash
|
||||
run: |
|
||||
${{ github.action_path }}/scripts/setup-git.sh \
|
||||
"${{ inputs.author_name }}" \
|
||||
"${{ inputs.author_email }}"
|
||||
|
||||
- name: Generate and commit changelog (unreleased)
|
||||
if: steps.detect.outputs.version_changed == 'false'
|
||||
shell: bash
|
||||
run: |
|
||||
${{ github.action_path }}/scripts/generate-unreleased-changelog.sh
|
||||
|
||||
- name: Release from VERSION
|
||||
if: steps.detect.outputs.version_changed == 'true'
|
||||
shell: bash
|
||||
env:
|
||||
RELEASE_PUBLISH_TOKEN: ${{ inputs.token || '' }}
|
||||
run: |
|
||||
${{ github.action_path }}/scripts/release-from-version.sh
|
||||
- id: detect
|
||||
name: Detect version change + queue post work
|
||||
uses: ./.gitea/actions/with-post-step
|
||||
with:
|
||||
key: AUTOCHANGELOG
|
||||
#################### MAIN ####################
|
||||
main: |
|
||||
${{ github.action_path }}/scripts/detect-version-change.sh
|
||||
#################### POST ####################
|
||||
post: |
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
# VERSION_CHANGED kommt aus detect-Script via $GITHUB_ENV
|
||||
CLIFF_VERSION="$(
|
||||
${{ github.action_path }}/scripts/read-cliff-version.sh | tail -n1
|
||||
)"
|
||||
"${{ github.action_path }}/scripts/install-git-cliff.sh" "$CLIFF_VERSION"
|
||||
"${{ github.action_path }}/scripts/setup-git.sh" \
|
||||
"${{ inputs.author_name }}" "${{ inputs.author_email }}"
|
||||
if [[ "${VERSION_CHANGED:-false}" == "true" ]]; then
|
||||
# --- Release-Pfad ---
|
||||
RELEASE_PUBLISH_TOKEN='${{ inputs.token }}' \
|
||||
"${{ github.action_path }}/scripts/release-from-version.sh"
|
||||
else
|
||||
# --- Nur Changelog aktualisieren ---
|
||||
"${{ github.action_path }}/scripts/generate-unreleased-changelog.sh"
|
||||
fi
|
||||
|
Reference in New Issue
Block a user