feat: adicionar RELEASE v1.2.0 "Simplicity Edition" com melhorias de … #11
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
name: Validate Release | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: mbstring, xml, ctype, iconv, intl, pdo, dom, filter, gd, json, session | |
- name: Cache Composer packages | |
uses: actions/cache@v4 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress --no-dev --optimize-autoloader | |
- name: Validate composer.json | |
run: composer validate --strict | |
- name: Check PHP syntax | |
run: find src -name "*.php" -exec php -l {} \; | |
- name: Install dependencies for validation | |
run: composer install --prefer-dist --no-progress | |
- name: Run comprehensive release validation | |
run: | | |
echo "🚀 Running comprehensive validation for release..." | |
echo "📋 Using consolidated quality check with auto-version detection" | |
scripts/quality/quality-check.sh | |
- name: Prepare release validation | |
run: | | |
echo "📦 Running release preparation validation..." | |
chmod +x scripts/release/prepare_release.sh | |
scripts/release/prepare_release.sh | |
release: | |
needs: validate | |
runs-on: ubuntu-latest | |
name: Create Release | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: mbstring, xml, ctype, iconv, intl, pdo, dom, filter, gd, json, session | |
- name: Install dependencies (production only) | |
run: composer install --prefer-dist --no-progress --no-dev --optimize-autoloader | |
- name: Get tag version | |
id: tag_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Get version from VERSION file | |
id: version_file | |
run: | | |
if [ -f "VERSION" ]; then | |
FILE_VERSION=$(cat VERSION | tr -d '\n') | |
echo "FILE_VERSION=$FILE_VERSION" >> $GITHUB_OUTPUT | |
else | |
echo "FILE_VERSION=unknown" >> $GITHUB_OUTPUT | |
fi | |
- name: Verify version consistency | |
run: | | |
TAG_VERSION="${{ steps.tag_version.outputs.VERSION }}" | |
FILE_VERSION="${{ steps.version_file.outputs.FILE_VERSION }}" | |
# Remove 'v' prefix from tag if present | |
TAG_VERSION_CLEAN=${TAG_VERSION#v} | |
if [ "$TAG_VERSION_CLEAN" != "$FILE_VERSION" ]; then | |
echo "❌ Version mismatch: Tag '$TAG_VERSION_CLEAN' vs VERSION file '$FILE_VERSION'" | |
exit 1 | |
else | |
echo "✅ Version consistency verified: $FILE_VERSION" | |
fi | |
- name: Create archive | |
run: | | |
# Create clean directory for packaging | |
mkdir -p build/pivotphp-core | |
# Copy source files | |
cp -r src build/pivotphp-core/ | |
cp composer.json build/pivotphp-core/ | |
cp README.md build/pivotphp-core/ | |
cp LICENSE build/pivotphp-core/ | |
cp VERSION build/pivotphp-core/ | |
cp -r docs build/pivotphp-core/ | |
# Create tarball | |
cd build | |
tar -czf pivotphp-core-${{ steps.tag_version.outputs.VERSION }}.tar.gz pivotphp-core/ | |
zip -r pivotphp-core-${{ steps.tag_version.outputs.VERSION }}.zip pivotphp-core/ | |
- name: Generate changelog | |
id: changelog | |
run: | | |
# Extract changelog for this version from git commits | |
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") | |
if [ -n "$PREVIOUS_TAG" ]; then | |
CHANGELOG=$(git log $PREVIOUS_TAG..HEAD --pretty=format:"- %s" --reverse) | |
else | |
CHANGELOG=$(git log --pretty=format:"- %s" --reverse) | |
fi | |
# Save changelog to file for GitHub release | |
echo "## What's Changed in ${{ steps.version_file.outputs.FILE_VERSION }}" > changelog.md | |
echo "" >> changelog.md | |
echo "$CHANGELOG" >> changelog.md | |
echo "" >> changelog.md | |
echo "## 🚀 PivotPHP Core Features" >> changelog.md | |
echo "" >> changelog.md | |
echo "- **High Performance**: Optimized object pooling and memory management" >> changelog.md | |
echo "- **Express.js API**: Familiar and intuitive routing and middleware" >> changelog.md | |
echo "- **PSR Compliance**: Full PSR-7, PSR-15, and PSR-12 support" >> changelog.md | |
echo "- **Automatic Version Detection**: All scripts use VERSION file" >> changelog.md | |
echo "- **Consolidated Scripts**: Streamlined development workflow" >> changelog.md | |
echo "" >> changelog.md | |
echo "**Full Changelog**: https://github.com/PivotPHP/pivotphp-core/compare/$PREVIOUS_TAG...${{ steps.tag_version.outputs.VERSION }}" >> changelog.md | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.tag_version.outputs.VERSION }} | |
name: PivotPHP Core ${{ steps.tag_version.outputs.VERSION }} | |
body_path: changelog.md | |
files: | | |
build/pivotphp-core-${{ steps.tag_version.outputs.VERSION }}.tar.gz | |
build/pivotphp-core-${{ steps.tag_version.outputs.VERSION }}.zip | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
packagist: | |
needs: [validate, release] | |
runs-on: ubuntu-latest | |
name: Update Packagist | |
steps: | |
- name: Update Packagist | |
run: | | |
echo "📦 Updating Packagist for PivotPHP Core..." | |
curl -XPOST -H'content-type:application/json' 'https://packagist.org/api/update-package?username=PivotPHP&apiToken=${{ secrets.PACKAGIST_TOKEN }}' \ | |
-d'{"repository":{"url":"https://github.com/PivotPHP/pivotphp-core"}}' | |
continue-on-error: true |