Release #82
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 | |
| # Manual only. The daily schedule and the openapi-updated repository_dispatch | |
| # triggers were removed so a spec change never auto-publishes to wp.org without | |
| # review. Run a release deliberately with: | |
| # gh workflow run release.yml -f version_bump=patch|minor|major | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_bump: | |
| description: 'patch | minor | major' | |
| required: false | |
| default: 'patch' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| extensions: mysqli, zip, gd | |
| tools: composer | |
| coverage: none | |
| # Install dev deps for verification (PHPUnit, PHPStan, PHPCS). | |
| # Re-installed without --dev right before deploy. | |
| - run: composer install --prefer-dist | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - run: npm ci | |
| - name: Regenerate from live OpenAPI | |
| run: npm run generate | |
| # The translation template is a build artifact, regenerated every release so it | |
| # always describes the code being shipped. wp.org extracts its own copy from the | |
| # source; this one serves translators working from the GitHub zip. | |
| - name: Refresh the translation template | |
| run: | | |
| curl -sSL -o /tmp/wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
| php /tmp/wp-cli.phar i18n make-pot . languages/roxyapi.pot --slug=roxyapi --skip-audit --allow-root | |
| - name: Lint | |
| run: vendor/bin/phpcs --standard=phpcs.xml.dist | |
| - name: Static analysis | |
| run: vendor/bin/phpstan analyze --no-progress --memory-limit=1G | |
| - name: Build blocks | |
| run: npm run build:all | |
| - name: PHPUnit | |
| env: | |
| DB_HOST: 127.0.0.1 | |
| run: | | |
| sudo apt-get install -y -qq subversion | |
| sudo systemctl start mysql | |
| mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS wordpress_test;" | |
| bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 latest true | |
| vendor/bin/phpunit | |
| - name: Reinstall composer without dev deps for shipped vendor/ | |
| run: composer install --no-dev --optimize-autoloader --prefer-dist | |
| - name: Bump version | |
| id: bump | |
| run: | | |
| BUMP="${{ github.event.inputs.version_bump || 'patch' }}" | |
| npm version "$BUMP" --no-git-tag-version | |
| VERSION=$(node -p "require('./package.json').version") | |
| # readme.txt notes are HAND-authored: this job only rewrites Stable tag. | |
| # Without this gate a release ships with the previous version as its | |
| # newest note, and a site owner has no way to see what changed. | |
| ENTRIES=$(grep -c "^= $VERSION =\$" readme.txt || true) | |
| if [ "$ENTRIES" -lt 2 ]; then | |
| echo "::error::readme.txt needs a '= $VERSION =' entry under BOTH == Changelog == and == Upgrade Notice == (found $ENTRIES of 2). They are hand-written; add them, then re-run." | |
| exit 1 | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| sed -i "s/^\(\s*\*\s*Version:\s*\).*/\1$VERSION/" roxyapi.php | |
| sed -i "s/const ROXYAPI_VERSION\s*=\s*'[^']*';/const ROXYAPI_VERSION = '$VERSION';/" roxyapi.php | |
| sed -i "s/^Stable tag:.*$/Stable tag: $VERSION/" readme.txt | |
| - name: Commit, tag, push | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| VERSION="${{ steps.bump.outputs.version }}" | |
| git add . | |
| git commit -m "release: v$VERSION" | |
| git tag "v$VERSION" | |
| git push --follow-tags | |
| - name: Deploy to WordPress.org | |
| id: deploy | |
| uses: 10up/action-wordpress-plugin-deploy@stable | |
| with: | |
| generate-zip: true | |
| env: | |
| SVN_USERNAME: ${{ secrets.SVN_USERNAME }} | |
| SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} | |
| SLUG: roxyapi | |
| VERSION: ${{ steps.bump.outputs.version }} | |
| - name: Attach zip to GitHub release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: v${{ steps.bump.outputs.version }} | |
| files: ${{ steps.deploy.outputs.zip-path }} | |
| generate_release_notes: true |