Files
twilio-wp-plugin/.gitea/workflows/release.yml
Claude d5a09fb337 Bump PHP to 8.1 minimum and resolve composer.lock in CI
The Gitea release build failed because aws/aws-sdk-php 3.371+ requires PHP
>= 8.1, while composer.json's platform was pinned to 8.0. Production runs
PHP 8.5.4, so bumping the minimum to 8.1 is well within the runtime envelope.

Changes:
  composer.json                 — require php >=8.1, platform.php = 8.1
  .gitea/workflows/release.yml  — setup-php now installs PHP 8.1
                                  added pre-install step that runs
                                  `composer update --no-install` only when
                                  composer.lock is absent. If a lock file is
                                  ever committed later, CI uses it directly
                                  for deterministic installs instead of
                                  regenerating.
  twilio-wp-plugin.php          — added "Requires PHP: 8.1" header so
                                  WordPress itself enforces the minimum
  README.md, CLAUDE.md          — doc bump from 8.0 to 8.1, with note that
                                  the AWS SDK is the constraint driver

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 09:20:06 -07:00

101 lines
3.6 KiB
YAML

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: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: composer
- name: Generate composer.lock if missing
run: |
if [ ! -f composer.lock ]; then
echo "No composer.lock present — resolving dependencies."
composer update --no-dev --no-install --no-interaction --prefer-dist
else
echo "Using committed composer.lock."
fi
- name: Install Composer dependencies
run: composer install --no-dev --prefer-dist --optimize-autoloader --no-interaction
- 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 with actual version
sed -i "s/Version: {auto_update_value_on_deploy}/Version: ${{ steps.get_version.outputs.version }}/" twilio-wp-plugin.php
sed -i "s/TWP_VERSION', '{auto_update_value_on_deploy}/TWP_VERSION', '${{ steps.get_version.outputs.version }}/" twilio-wp-plugin.php
# Verify the changes were made
grep "Version:" twilio-wp-plugin.php
grep "TWP_VERSION" twilio-wp-plugin.php
- name: Create ZIP archive
run: |
# Create a temp directory with the correct plugin folder name
mkdir -p /tmp/twilio-wp-plugin
# Copy files to the temp directory (excluding git and other unnecessary files)
cp -r * /tmp/twilio-wp-plugin/ 2>/dev/null || true
# Exclude .git and .gitea directories
rm -rf /tmp/twilio-wp-plugin/.git /tmp/twilio-wp-plugin/.gitea 2>/dev/null || true
# Create the ZIP file with the proper structure
cd /tmp
zip -r $GITHUB_WORKSPACE/twilio-wp-plugin.zip twilio-wp-plugin
- name: Create Release
uses: softprops/action-gh-release@v2
with:
token: "${{ secrets.REPO_TOKEN }}"
title: "Twilio WP Plugin Release ${{ steps.get_version.outputs.version }}"
tag_name: ${{ steps.get_version.outputs.version }}
body: "${{ steps.release_notes.outputs.notes }}"
files: |
twilio-wp-plugin.zip