mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-21 20:52:12 -03:00
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: Poprawione obsługa multi-line output (z delimiterem EOF, bez zastępowania \n)
|
|
- 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)
|
|
|
|
# Jeśli brak commitów, ustaw domyślną wiadomość
|
|
if [ -z "$HISTORY" ]; then
|
|
HISTORY="No changes since last release."
|
|
fi
|
|
|
|
# Ustaw multi-line output z delimiterem (zachowuje oryginalne nowe linie)
|
|
echo "commit_history<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$HISTORY" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $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 }} |