You've already forked wp-fedistream
Some checks failed
Create Release Package / build-release (push) Failing after 4s
- Automated release builds triggered by v* tags - PHP 8.3 environment with production dependencies - Automatic translation compilation (.po to .mo) - Version verification (plugin version must match tag) - WordPress-compliant zip structure - SHA256 checksum generation - Package structure verification - Changelog extraction for release notes - Automatic Gitea release creation with attachments Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
154 lines
5.3 KiB
YAML
154 lines
5.3 KiB
YAML
name: Create Release Package
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build-release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.3'
|
|
extensions: mbstring, xml, zip, intl, gettext
|
|
tools: composer:v2
|
|
|
|
- name: Get version from tag
|
|
id: version
|
|
run: |
|
|
VERSION=${GITHUB_REF_NAME#v}
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "Building version: $VERSION"
|
|
|
|
- name: Validate composer.json
|
|
run: composer validate --strict
|
|
|
|
- name: Install Composer dependencies (production)
|
|
run: |
|
|
composer config platform.php 8.3.0
|
|
composer install --no-dev --optimize-autoloader --no-interaction
|
|
|
|
- name: Compile translations
|
|
run: |
|
|
for po in languages/*.po; do
|
|
if [ -f "$po" ]; then
|
|
mo="${po%.po}.mo"
|
|
echo "Compiling $po to $mo"
|
|
msgfmt -o "$mo" "$po"
|
|
fi
|
|
done
|
|
|
|
- name: Verify plugin version matches tag
|
|
run: |
|
|
PLUGIN_VERSION=$(grep -oP "Version:\s*\K[0-9]+\.[0-9]+\.[0-9]+" wp-fedistream.php | head -1)
|
|
TAG_VERSION=${{ steps.version.outputs.version }}
|
|
if [ "$PLUGIN_VERSION" != "$TAG_VERSION" ]; then
|
|
echo "Error: Plugin version ($PLUGIN_VERSION) does not match tag version ($TAG_VERSION)"
|
|
exit 1
|
|
fi
|
|
echo "Version verified: $PLUGIN_VERSION"
|
|
|
|
- name: Create release directory
|
|
run: mkdir -p releases
|
|
|
|
- name: Build release package
|
|
run: |
|
|
VERSION=${{ steps.version.outputs.version }}
|
|
PLUGIN_NAME="wp-fedistream"
|
|
RELEASE_FILE="releases/${PLUGIN_NAME}-${VERSION}.zip"
|
|
|
|
# Move to parent directory for proper zip structure
|
|
cd ..
|
|
|
|
# Create zip with proper WordPress plugin structure
|
|
zip -r "${PLUGIN_NAME}/${RELEASE_FILE}" "${PLUGIN_NAME}" \
|
|
-x "${PLUGIN_NAME}/.git/*" \
|
|
-x "${PLUGIN_NAME}/.gitea/*" \
|
|
-x "${PLUGIN_NAME}/.github/*" \
|
|
-x "${PLUGIN_NAME}/.vscode/*" \
|
|
-x "${PLUGIN_NAME}/.claude/*" \
|
|
-x "${PLUGIN_NAME}/CLAUDE.md" \
|
|
-x "${PLUGIN_NAME}/wp-core" \
|
|
-x "${PLUGIN_NAME}/wp-core/*" \
|
|
-x "${PLUGIN_NAME}/wp-plugins" \
|
|
-x "${PLUGIN_NAME}/wp-plugins/*" \
|
|
-x "${PLUGIN_NAME}/releases/*" \
|
|
-x "${PLUGIN_NAME}/composer.lock" \
|
|
-x "${PLUGIN_NAME}/*.log" \
|
|
-x "${PLUGIN_NAME}/.gitignore" \
|
|
-x "${PLUGIN_NAME}/.editorconfig" \
|
|
-x "${PLUGIN_NAME}/phpcs.xml*" \
|
|
-x "${PLUGIN_NAME}/phpunit.xml*" \
|
|
-x "${PLUGIN_NAME}/tests/*" \
|
|
-x "${PLUGIN_NAME}/*.po~" \
|
|
-x "${PLUGIN_NAME}/*.bak" \
|
|
-x "*.DS_Store"
|
|
|
|
cd "${PLUGIN_NAME}"
|
|
echo "Created: ${RELEASE_FILE}"
|
|
|
|
- name: Generate checksums
|
|
run: |
|
|
VERSION=${{ steps.version.outputs.version }}
|
|
RELEASE_FILE="releases/wp-fedistream-${VERSION}.zip"
|
|
|
|
cd releases
|
|
sha256sum "wp-fedistream-${VERSION}.zip" > "wp-fedistream-${VERSION}.zip.sha256"
|
|
|
|
echo "SHA256:"
|
|
cat "wp-fedistream-${VERSION}.zip.sha256"
|
|
|
|
- name: Verify package structure
|
|
run: |
|
|
VERSION=${{ steps.version.outputs.version }}
|
|
echo "Package contents:"
|
|
unzip -l "releases/wp-fedistream-${VERSION}.zip" | head -50
|
|
|
|
# Verify main file is at correct location
|
|
if unzip -l "releases/wp-fedistream-${VERSION}.zip" | grep -q "wp-fedistream/wp-fedistream.php"; then
|
|
echo "✓ Main plugin file at correct location"
|
|
else
|
|
echo "✗ Error: Main plugin file not found at wp-fedistream/wp-fedistream.php"
|
|
exit 1
|
|
fi
|
|
|
|
# Verify vendor directory is included
|
|
if unzip -l "releases/wp-fedistream-${VERSION}.zip" | grep -q "wp-fedistream/vendor/"; then
|
|
echo "✓ Vendor directory included"
|
|
else
|
|
echo "✗ Error: Vendor directory not found"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Extract changelog for release notes
|
|
id: changelog
|
|
run: |
|
|
VERSION=${{ steps.version.outputs.version }}
|
|
# Extract changelog section for this version
|
|
NOTES=$(sed -n "/^## \[${VERSION}\]/,/^## \[/p" CHANGELOG.md | sed '$ d' | tail -n +2)
|
|
if [ -z "$NOTES" ]; then
|
|
NOTES="Release version ${VERSION}"
|
|
fi
|
|
# Save to file for multi-line output
|
|
echo "$NOTES" > release_notes.txt
|
|
echo "Release notes extracted"
|
|
|
|
- name: Create Gitea Release
|
|
uses: actions/gitea-release-action@v1
|
|
with:
|
|
token: ${{ secrets.GITEA_TOKEN }}
|
|
tag_name: ${{ github.ref_name }}
|
|
release_name: "Release ${{ steps.version.outputs.version }}"
|
|
body_path: release_notes.txt
|
|
draft: false
|
|
prerelease: ${{ contains(github.ref_name, '-') }}
|
|
files: |
|
|
releases/wp-fedistream-${{ steps.version.outputs.version }}.zip
|
|
releases/wp-fedistream-${{ steps.version.outputs.version }}.zip.sha256
|