Release 1.1.0 #6
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: | |
| branches: | |
| - main | |
| paths: | |
| - 'lw-pixel.php' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract version from plugin file | |
| id: get_version | |
| run: | | |
| VERSION=$(grep -m1 "Version:" lw-pixel.php | sed 's/.*Version:[[:space:]]*//' | tr -d '[:space:]') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Extracted version: $VERSION" | |
| - name: Check if tag exists | |
| id: check_tag | |
| env: | |
| VERSION: ${{ steps.get_version.outputs.version }} | |
| run: | | |
| if git rev-parse "v$VERSION" >/dev/null 2>&1; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "Tag v$VERSION already exists" | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| echo "Tag v$VERSION does not exist" | |
| fi | |
| - name: Setup PHP | |
| if: steps.check_tag.outputs.exists == 'false' | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.2' | |
| - name: Install production dependencies | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: composer install --no-dev --optimize-autoloader --no-interaction | |
| - name: Create release ZIP | |
| if: steps.check_tag.outputs.exists == 'false' | |
| env: | |
| VERSION: ${{ steps.get_version.outputs.version }} | |
| run: | | |
| mkdir -p dist/lw-pixel | |
| rsync -av --exclude='.git' --exclude='.github' --exclude='dist' \ | |
| --exclude='builds' --exclude='composer.json' --exclude='composer.lock' \ | |
| --exclude='phpcs.xml.dist' --exclude='node_modules' --exclude='.gitignore' \ | |
| --exclude='bin' --exclude='tests' --exclude='docs' \ | |
| --exclude='phpstan.neon.dist' --exclude='phpstan-baseline.neon' \ | |
| --exclude='phpstan-bootstrap.php' --exclude='phpunit.xml.dist' --exclude='.claude' \ | |
| --exclude='*.log' . dist/lw-pixel/ | |
| cd dist && zip -r "lw-pixel-${VERSION}.zip" lw-pixel/ | |
| - name: Create tag and release | |
| if: steps.check_tag.outputs.exists == 'false' | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: v${{ steps.get_version.outputs.version }} | |
| name: v${{ steps.get_version.outputs.version }} | |
| body: | | |
| ## LW Pixel v${{ steps.get_version.outputs.version }} | |
| ### Installation | |
| **Via Composer:** | |
| ```bash | |
| composer require lwplugins/lw-pixel | |
| ``` | |
| **Manual Installation:** | |
| 1. Download `lw-pixel-${{ steps.get_version.outputs.version }}.zip` | |
| 2. Upload to `/wp-content/plugins/` | |
| 3. Activate in WordPress admin | |
| ### Changelog | |
| See [readme.txt](https://github.com/lwplugins/lw-pixel/blob/main/readme.txt) for full changelog. | |
| files: | | |
| dist/lw-pixel-${{ steps.get_version.outputs.version }}.zip | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |