Major improvements: Fix download limits, enhance license display, fix software filenames
🔧 Bug Fixes: - Fixed download limits defaulting to 5 instead of 0 for unlimited downloads - Fixed software license filename sanitization (spaces→dashes, dots→underscores, proper .zip extension) - Software downloads now show as "Test-Plugin-v2-2-0.zip" instead of "Test Plugin v2.2.0" ✨ UI/UX Enhancements: - Redesigned license key display to span full table width with FontAwesome copy icons - Added responsive CSS styling for license key rows - Integrated FontAwesome CDN for modern copy icons 🏗️ Architecture Improvements: - Added comprehensive filename sanitization in both download handler and API paths - Enhanced software license product handling for local package files - Improved error handling and logging throughout download processes 📦 Infrastructure: - Added Gitea workflows for automated releases on push to main - Created comprehensive .gitignore excluding test files and browser automation - Updated documentation with all recent improvements and technical insights 🔍 Technical Details: - Software license products served from wp-content/uploads/wpdd-packages/ - Download flow: token → process_download_by_token() → process_download() → deliver_file() - Dual path coverage for both API downloads and regular file delivery - Version placeholder system for automated deployment 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
84
.gitea/workflows/release.yml
Normal file
84
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,84 @@
|
||||
name: Create Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
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
|
||||
run: |
|
||||
if [ "${{ github.ref_type }}" = "tag" ]; then
|
||||
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "version=$(date +'%Y.%m.%d-%H%M')" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- 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
|
||||
|
||||
# Create release notes with header (without encoding newlines)
|
||||
echo "notes<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "## What's New in ${{ steps.get_version.outputs.version }}" >> $GITHUB_OUTPUT
|
||||
echo "" >> $GITHUB_OUTPUT
|
||||
echo "$COMMITS" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Update plugin version
|
||||
run: |
|
||||
# Replace version placeholder in plugin header
|
||||
sed -i "s/Version: .*/Version: ${{ steps.get_version.outputs.version }}/" wp-digital-download.php
|
||||
# Replace version placeholder in PHP constant
|
||||
sed -i "s/define('WPDD_VERSION', '[^']*');/define('WPDD_VERSION', '${{ steps.get_version.outputs.version }}');/" wp-digital-download.php
|
||||
# Verify the changes were made
|
||||
echo "Plugin header version:"
|
||||
grep "Version:" wp-digital-download.php
|
||||
echo "PHP constant version:"
|
||||
grep "WPDD_VERSION" wp-digital-download.php
|
||||
|
||||
- name: Create ZIP archive
|
||||
run: |
|
||||
# Create a temp directory with the correct plugin folder name
|
||||
mkdir -p /tmp/wp-digital-download
|
||||
|
||||
# Copy files to the temp directory (excluding git and other unnecessary files)
|
||||
cp -r * /tmp/wp-digital-download/ 2>/dev/null || true
|
||||
|
||||
# Exclude .git, .gitea, and .playwright-mcp directories
|
||||
rm -rf /tmp/wp-digital-download/.git /tmp/wp-digital-download/.gitea /tmp/wp-digital-download/.playwright-mcp 2>/dev/null || true
|
||||
|
||||
# Create the ZIP file with the proper structure
|
||||
cd /tmp
|
||||
zip -r $GITHUB_WORKSPACE/wp-digital-download.zip wp-digital-download
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
token: "${{ secrets.REPO_TOKEN }}"
|
||||
title: "WP Digital Download Release ${{ steps.get_version.outputs.version }}"
|
||||
tag_name: ${{ steps.get_version.outputs.version }}
|
||||
body: "${{ steps.release_notes.outputs.notes }}"
|
||||
files: |
|
||||
wp-digital-download.zip
|
57
.gitea/workflows/update-version.yml
Normal file
57
.gitea/workflows/update-version.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
name: Update Plugin Version
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created, edited]
|
||||
|
||||
jobs:
|
||||
update-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get release tag
|
||||
id: get_tag
|
||||
run: echo "TAG=${GITEA_REF#refs/tags/}" >> $GITEA_ENV
|
||||
|
||||
- name: Update version in plugin file
|
||||
run: |
|
||||
# Replace version in plugin header
|
||||
sed -i "s/Version: .*/Version: ${{ env.TAG }}/" wp-digital-download.php
|
||||
|
||||
# Replace version in PHP constant
|
||||
sed -i "s/define('WPDD_VERSION', '[^']*');/define('WPDD_VERSION', '${{ env.TAG }}');/" wp-digital-download.php
|
||||
|
||||
# Verify changes
|
||||
echo "Plugin header version:"
|
||||
grep "Version:" wp-digital-download.php
|
||||
echo "PHP constant version:"
|
||||
grep "WPDD_VERSION" wp-digital-download.php
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git config --local user.email "action@gitea.com"
|
||||
git config --local user.name "Gitea Action"
|
||||
git add wp-digital-download.php
|
||||
git commit -m "Update version to ${{ env.TAG }}"
|
||||
git push
|
||||
|
||||
- name: Create plugin zip
|
||||
run: |
|
||||
mkdir -p /tmp/wp-digital-download
|
||||
rsync -av --exclude=".git" --exclude=".gitea" --exclude=".playwright-mcp" --exclude="build" . /tmp/wp-digital-download/
|
||||
cd /tmp
|
||||
zip -r $GITEA_WORK_DIR/wp-digital-download.zip wp-digital-download
|
||||
|
||||
- name: Upload zip to release
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ gitea.event.release.upload_url }}
|
||||
asset_path: build/wp-digital-download.zip
|
||||
asset_name: wp-digital-download.zip
|
||||
asset_content_type: application/zip
|
Reference in New Issue
Block a user