Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
5771982931 | |||
2df09c467e
|
|||
09e41744fb
|
|||
e12595d0a8 | |||
4254a7f534
|
|||
543b311d1e
|
|||
313ace34fe | |||
df2ba3b060
|
|||
27ee1746db
|
|||
03add717be | |||
01986944f0
|
|||
c25b2e9cd5
|
|||
f44f457e6b | |||
169d9ec4db
|
|||
cbcd5e2ab7
|
11
.gitea/actions/with-post-step/action.yml
Normal file
11
.gitea/actions/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
.gitea/actions/with-post-step/main.js
Normal file
18
.gitea/actions/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);
|
||||
}
|
@@ -14,6 +14,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- 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:
|
||||
token: ${{ secrets.RELEASE_PUBLISH_TOKEN }}
|
||||
allow_non_main_release: "true"
|
||||
|
25
CHANGELOG.md
25
CHANGELOG.md
@@ -2,6 +2,31 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [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
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(script)* Use dynamic branch name for git push - ([27ee174](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/27ee1746dbc7b2c6c1564a04c024337ff158a9c5))
|
||||
|
||||
## [0.4.2](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v0.4.1..v0.4.2) - 2025-06-29
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(action)* Update conditions for version detection - ([c25b2e9](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/c25b2e9cd551e923b84cd144b818940fd5e1ccff))
|
||||
|
||||
## [0.4.1](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v0.4.0..v0.4.1) - 2025-06-29
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(action)* Standardize input key naming - ([cbcd5e2](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/cbcd5e2ab7e7f2498021d5043da9999f62dcf44d))
|
||||
|
||||
## [0.4.0](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v0.3.6..v0.4.0) - 2025-06-29
|
||||
|
||||
### 🚀 Features
|
||||
|
100
action.yml
100
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: ""
|
||||
allow-non-main-release:
|
||||
description: "Allow publishing releases from branches other than 'main'."
|
||||
required: false
|
||||
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 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' || github.ref != 'refs/heads/main'
|
||||
shell: bash
|
||||
run: |
|
||||
${{ github.action_path }}/scripts/generate-unreleased-changelog.sh
|
||||
|
||||
- name: Release from VERSION
|
||||
if: steps.detect.outputs.version_changed == 'true' && github.ref == 'refs/heads/main'
|
||||
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
|
||||
|
@@ -12,10 +12,11 @@ fi
|
||||
VERSION_LINE=$(awk -F '=' '/^# CLIFF_VERSION=/ { gsub(/[" ]/, "", $2); print $2 }' "$CLIFF_TOML" || true)
|
||||
|
||||
if [[ -n "$VERSION_LINE" ]]; then
|
||||
echo "✅ Extracted CLIFF_VERSION: $VERSION_LINE"
|
||||
echo "✅ Extracted CLIFF_VERSION: $VERSION_LINE" >&2
|
||||
else
|
||||
echo "⚠️ No CLIFF_VERSION found in $CLIFF_TOML"
|
||||
echo "⚠️ No CLIFF_VERSION found in $CLIFF_TOML" >&2
|
||||
fi
|
||||
|
||||
# Output für GitHub Actions / Composite Action
|
||||
echo "version=${VERSION_LINE:-}" >> "$GITHUB_OUTPUT"
|
||||
echo "$VERSION_LINE"
|
||||
n
|
@@ -52,6 +52,7 @@ VERSION_FILE="VERSION"
|
||||
CHANGELOG_FILE="CHANGELOG.md"
|
||||
CLIFF_CONFIG="cliff.toml"
|
||||
RELEASE_BODY_TMP="$(mktemp)"
|
||||
GIT_BRANCH="${GITHUB_REF##refs/heads/}"
|
||||
|
||||
# === Step 1: Read version ===
|
||||
if [[ ! -f "$VERSION_FILE" ]]; then
|
||||
@@ -87,7 +88,7 @@ if git diff --cached --quiet; then
|
||||
else
|
||||
echo "📝 Committing updated changelog"
|
||||
git commit -m "chore(changelog): update changelog for v$VERSION"
|
||||
git push origin main
|
||||
git push origin "$GIT_BRANCH"
|
||||
fi
|
||||
|
||||
# === Step 4: Create tag if necessary ===
|
||||
|
Reference in New Issue
Block a user