mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-21 20:52:12 -03:00
The release workflow now fetches the full git history and displays all commit messages since the last tag in the release notes, instead of only the latest commit. Also bumps the project version to 1.3.8 in pyproject.toml.
78 lines
2.6 KiB
YAML
78 lines
2.6 KiB
YAML
name: Auto Release with Version Check
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # Pobierz pełną historię Git (potrzebne do git log)
|
|
|
|
- name: Extract base version from pyproject.toml
|
|
id: version
|
|
run: |
|
|
base=$(grep '^version *= *"' pyproject.toml | sed -E 's/version *= *"([^"]+)"/\1/')
|
|
echo "base_version=$base" >> $GITHUB_OUTPUT
|
|
|
|
- name: Check if tag for this version already exists
|
|
run: |
|
|
TAG="v${{ steps.version.outputs.base_version }}"
|
|
git fetch --tags
|
|
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
|
echo "Tag $TAG already exists. Skipping release."
|
|
exit 0
|
|
fi
|
|
|
|
- name: Set version tag
|
|
id: unique_tag
|
|
run: |
|
|
echo "final_tag=v${{ steps.version.outputs.base_version }}" >> $GITHUB_OUTPUT
|
|
|
|
# ZMIANA: Zamiast tylko ostatniego commita, pobierz historię commitów od ostatniego tagu
|
|
- name: Get commit history since last tag
|
|
id: commit_history
|
|
run: |
|
|
# Znajdź ostatni tag (jeśli istnieje)
|
|
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
|
|
|
# Jeśli nie ma ostatniego tagu, użyj pustego (pobierz od początku repo)
|
|
if [ -z "$LAST_TAG" ]; then
|
|
RANGE="HEAD"
|
|
else
|
|
RANGE="$LAST_TAG..HEAD"
|
|
fi
|
|
|
|
# Pobierz listę commitów (tylko subject/tytuł, format: - Commit message)
|
|
HISTORY=$(git log --pretty=format:"- %s" $RANGE)
|
|
|
|
# Zastąp nowe linie na \\n, aby dobrze wyglądało w output
|
|
HISTORY=${HISTORY//$'\n'/\\n}
|
|
|
|
# Jeśli brak commitów, ustaw domyślną wiadomość
|
|
if [ -z "$HISTORY" ]; then
|
|
HISTORY="No changes since last release."
|
|
fi
|
|
|
|
echo "commit_history=$HISTORY" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
tag_name: ${{ steps.unique_tag.outputs.final_tag }}
|
|
name: Release ${{ steps.unique_tag.outputs.final_tag }}
|
|
body: |
|
|
📦 Release based on pyproject.toml version `${{ steps.version.outputs.base_version }}`
|
|
|
|
📝 Changes since last release:
|
|
```
|
|
${{ steps.commit_history.outputs.commit_history }}
|
|
```
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |