Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
5abdff1d1c | |||
ec44bde050
|
|||
30f83b08ee
|
|||
5771982931 | |||
2df09c467e
|
|||
09e41744fb
|
|||
e12595d0a8 | |||
4254a7f534
|
|||
543b311d1e
|
@@ -14,6 +14,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: https://git.0xmax42.io/actions/auto-changelog-release-action@v0.3.0
|
uses: https://git.0xmax42.io/actions/auto-changelog-release-action@v0
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.RELEASE_PUBLISH_TOKEN }}
|
token: ${{ secrets.RELEASE_PUBLISH_TOKEN }}
|
||||||
|
allow_non_main_release: "true"
|
||||||
|
13
CHANGELOG.md
13
CHANGELOG.md
@@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [2.0.2](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v2.0.1..v2.0.2) - 2025-07-04
|
||||||
|
|
||||||
|
### 🚜 Refactor
|
||||||
|
|
||||||
|
- *(actions)* Simplify action path structure - ([30f83b0](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/30f83b08eecabe17b7d1f53aaf0bb4d0cdd82256))
|
||||||
|
|
||||||
|
## [2.0.1](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v0.4.3..v2.0.1) - 2025-07-04
|
||||||
|
|
||||||
|
### 🚀 Features
|
||||||
|
|
||||||
|
- *(workflows)* Allow non-main branch releases - ([09e4174](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/09e41744fbf920c0253e13644cb38f1dd430c0f3))
|
||||||
|
- *(actions)* Add post-step support for composite actions - ([543b311](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/543b311d1eb1fb83e8e0ef4014c549e61a863038))
|
||||||
|
|
||||||
## [0.4.3](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v0.4.2..v0.4.3) - 2025-06-29
|
## [0.4.3](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v0.4.2..v0.4.3) - 2025-06-29
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
98
action.yml
98
action.yml
@@ -1,66 +1,46 @@
|
|||||||
name: Auto Changelog & Release
|
name: "Auto Changelog & Release"
|
||||||
description: "One-stop composite action for version-bump detection, changelog generation and Gitea release."
|
description: "Detects version bump and, in post-step, writes changelog or publishes release."
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
token:
|
token: { description: "Gitea/GitHub PAT", default: "" }
|
||||||
description: "Gitea/GitHub PAT für Release-API"
|
author_name: { description: "Commit author", default: "" }
|
||||||
required: false
|
author_email: { description: "Commit e-mail", default: "" }
|
||||||
default: ""
|
|
||||||
author_name:
|
|
||||||
description: "Commit-Autorname"
|
|
||||||
required: false
|
|
||||||
default: ""
|
|
||||||
author_email:
|
|
||||||
description: "Commit-Autore-Mail"
|
|
||||||
required: false
|
|
||||||
default: ""
|
|
||||||
allow_non_main_release:
|
allow_non_main_release:
|
||||||
description: "Allow publishing releases from branches other than 'main'."
|
description: "Allow release on branches ≠ main"
|
||||||
required: false
|
|
||||||
default: "false"
|
default: "false"
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
release:
|
||||||
|
description: "true if VERSION changed"
|
||||||
|
value: ${{ steps.detect.outputs.version_changed }}
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Detect version change
|
- id: detect
|
||||||
shell: bash
|
name: Detect version change + queue post work
|
||||||
id: detect
|
uses: ./with-post-step
|
||||||
env:
|
with:
|
||||||
GITHUB_EVENT_BEFORE: ${{ github.event.before || '' }}
|
key: AUTOCHANGELOG
|
||||||
GITHUB_SHA: ${{ github.sha || '' }}
|
#################### MAIN ####################
|
||||||
GITHUB_REF: ${{ github.ref || '' }}
|
main: |
|
||||||
ALLOW_NON_MAIN_RELEASE: ${{ inputs.allow_non_main_release }}
|
${{ github.action_path }}/scripts/detect-version-change.sh
|
||||||
run: |
|
#################### POST ####################
|
||||||
${{ github.action_path }}/scripts/detect-version-change.sh
|
post: |
|
||||||
|
#!/usr/bin/env bash
|
||||||
- name: Read CLIFF_VERSION
|
set -euo pipefail
|
||||||
shell: bash
|
# VERSION_CHANGED kommt aus detect-Script via $GITHUB_ENV
|
||||||
id: cliff_version
|
CLIFF_VERSION="$(
|
||||||
run: |
|
${{ github.action_path }}/scripts/read-cliff-version.sh | tail -n1
|
||||||
${{ github.action_path }}/scripts/read-cliff-version.sh
|
)"
|
||||||
|
"${{ github.action_path }}/scripts/install-git-cliff.sh" "$CLIFF_VERSION"
|
||||||
- name: Install git-cliff
|
"${{ github.action_path }}/scripts/setup-git.sh" \
|
||||||
shell: bash
|
"${{ inputs.author_name }}" "${{ inputs.author_email }}"
|
||||||
run: |
|
if [[ "${VERSION_CHANGED:-false}" == "true" ]]; then
|
||||||
${{ github.action_path }}/scripts/install-git-cliff.sh "${{ steps.cliff_version.outputs.version }}"
|
# --- Release-Pfad ---
|
||||||
|
RELEASE_PUBLISH_TOKEN='${{ inputs.token }}' \
|
||||||
- name: Set up git
|
"${{ github.action_path }}/scripts/release-from-version.sh"
|
||||||
shell: bash
|
else
|
||||||
run: |
|
# --- Nur Changelog aktualisieren ---
|
||||||
${{ github.action_path }}/scripts/setup-git.sh \
|
"${{ github.action_path }}/scripts/generate-unreleased-changelog.sh"
|
||||||
"${{ inputs.author_name }}" \
|
fi
|
||||||
"${{ 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
|
|
||||||
|
@@ -12,10 +12,11 @@ fi
|
|||||||
VERSION_LINE=$(awk -F '=' '/^# CLIFF_VERSION=/ { gsub(/[" ]/, "", $2); print $2 }' "$CLIFF_TOML" || true)
|
VERSION_LINE=$(awk -F '=' '/^# CLIFF_VERSION=/ { gsub(/[" ]/, "", $2); print $2 }' "$CLIFF_TOML" || true)
|
||||||
|
|
||||||
if [[ -n "$VERSION_LINE" ]]; then
|
if [[ -n "$VERSION_LINE" ]]; then
|
||||||
echo "✅ Extracted CLIFF_VERSION: $VERSION_LINE"
|
echo "✅ Extracted CLIFF_VERSION: $VERSION_LINE" >&2
|
||||||
else
|
else
|
||||||
echo "⚠️ No CLIFF_VERSION found in $CLIFF_TOML"
|
echo "⚠️ No CLIFF_VERSION found in $CLIFF_TOML" >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Output für GitHub Actions / Composite Action
|
|
||||||
echo "version=${VERSION_LINE:-}" >> "$GITHUB_OUTPUT"
|
echo "version=${VERSION_LINE:-}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "$VERSION_LINE"
|
||||||
|
n
|
11
with-post-step/action.yml
Normal file
11
with-post-step/action.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
name: "with-post-step"
|
||||||
|
description: "Runs a main command and, afterwards, a post command."
|
||||||
|
inputs:
|
||||||
|
main: { description: "Command for the main step", required: true }
|
||||||
|
post: { description: "Command for the post step", required: true }
|
||||||
|
key: { description: "State key", default: POST }
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: node20
|
||||||
|
main: main.js
|
||||||
|
post: main.js
|
18
with-post-step/main.js
Normal file
18
with-post-step/main.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
const { spawn } = require("child_process");
|
||||||
|
const { appendFileSync } = require("fs");
|
||||||
|
const { EOL } = require("os");
|
||||||
|
|
||||||
|
function run(cmd) {
|
||||||
|
const proc = spawn(cmd, { stdio: "inherit", shell: true });
|
||||||
|
proc.on("exit", code => process.exitCode = code);
|
||||||
|
}
|
||||||
|
|
||||||
|
const key = process.env.INPUT_KEY.toUpperCase();
|
||||||
|
if (process.env[`STATE_${key}`] !== undefined) {
|
||||||
|
// ---------- POST ----------
|
||||||
|
run(process.env.INPUT_POST);
|
||||||
|
} else {
|
||||||
|
// ---------- MAIN ----------
|
||||||
|
appendFileSync(process.env.GITHUB_STATE, `${key}=true${EOL}`);
|
||||||
|
run(process.env.INPUT_MAIN);
|
||||||
|
}
|
Reference in New Issue
Block a user