Major Update to add auto-update features
This commit is contained in:
@@ -14,6 +14,7 @@ jobs:
|
||||
with:
|
||||
username: ${{ secrets.CI_USER }}
|
||||
password: ${{ secrets.CI_TOKEN }}
|
||||
fetch-depth: 0 # Important: Fetch all history for commit messages
|
||||
|
||||
- name: Get version
|
||||
id: get_version
|
||||
@@ -24,6 +25,42 @@ jobs:
|
||||
echo "version=$(date +'%Y.%m.%d-%H%M')" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
# NEW STEP: Generate release notes from commits
|
||||
- name: Generate release notes
|
||||
id: release_notes
|
||||
run: |
|
||||
# Find the most recent tag
|
||||
LATEST_TAG=$(git describe --tags --abbrev=0 --always 2>/dev/null || echo "none")
|
||||
|
||||
if [ "$LATEST_TAG" = "none" ]; then
|
||||
# If no previous tag exists, get all commits
|
||||
COMMITS=$(git log --pretty=format:"* %s (%h)" --no-merges)
|
||||
else
|
||||
# Get commits since the last tag
|
||||
COMMITS=$(git log --pretty=format:"* %s (%h)" ${LATEST_TAG}..HEAD --no-merges)
|
||||
fi
|
||||
|
||||
# Escape newlines and special characters for GitHub Actions
|
||||
COMMITS="${COMMITS//'%'/'%25'}"
|
||||
COMMITS="${COMMITS//$'\n'/'%0A'}"
|
||||
COMMITS="${COMMITS//$'\r'/'%0D'}"
|
||||
|
||||
# Create release notes with header
|
||||
NOTES="## What's New in ${{ steps.get_version.outputs.version }}%0A%0A"
|
||||
NOTES+="$COMMITS"
|
||||
|
||||
# Output to GitHub Actions
|
||||
echo "notes<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "$NOTES" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Update plugin version
|
||||
run: |
|
||||
# Replace version placeholder with actual version
|
||||
sed -i "s/Version: {auto_update_value_on_deploy}/Version: ${{ steps.get_version.outputs.version }}/" fw-store-embed.php
|
||||
# Verify the change was made
|
||||
grep "Version:" fw-store-embed.php
|
||||
|
||||
- name: Create ZIP archive
|
||||
run: |
|
||||
zip -r fourthwall-store-embed.zip . -x ".git/*" ".gitea/*"
|
||||
@@ -34,5 +71,6 @@ jobs:
|
||||
token: "${{ secrets.REPO_TOKEN }}"
|
||||
title: Fourthwall-store-embed Release ${{ steps.get_version.outputs.version }}
|
||||
tag_name: ${{ steps.get_version.outputs.version }}
|
||||
body: "${{ steps.release_notes.outputs.notes }}"
|
||||
files: |
|
||||
fourthwall-store-embed.zip
|
||||
fourthwall-store-embed.zip
|
Reference in New Issue
Block a user