fix: drop stale page mapping when CPT becomes ineligible #7
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 | |
| permissions: {} | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| outputs: | |
| release_created: ${{ steps.rp.outputs.release_created }} | |
| tag_name: ${{ steps.rp.outputs.tag_name }} | |
| version: ${{ steps.rp.outputs.version }} | |
| steps: | |
| - id: rp | |
| uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 | |
| build: | |
| needs: release-please | |
| if: needs.release-please.outputs.release_created == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0 | |
| with: | |
| php-version: '8.2' | |
| coverage: none | |
| - uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0 | |
| with: | |
| composer-options: '--no-dev --optimize-autoloader --classmap-authoritative' | |
| - name: Build release zip | |
| env: | |
| VERSION: ${{ needs.release-please.outputs.version }} | |
| run: | | |
| mkdir -p dist | |
| # Tracked files only, with .gitattributes export-ignore filtering applied. | |
| git archive --prefix=page-for-custom-post-type/ HEAD | tar -x -C dist | |
| # vendor/ is gitignored, so git archive doesn't include it. Copy it in. | |
| cp -r vendor dist/page-for-custom-post-type/vendor | |
| # Inject the bundled-only autoload require. | |
| sed -i "s|// @bundle-autoload|require_once __DIR__ . '/vendor/autoload.php';|" dist/page-for-custom-post-type/plugin.php | |
| grep -q "require_once __DIR__ . '/vendor/autoload.php';" dist/page-for-custom-post-type/plugin.php \ | |
| || { echo "::error::bundle autoload marker replacement failed"; exit 1; } | |
| php -l dist/page-for-custom-post-type/plugin.php | |
| (cd dist && zip -rq "../page-for-custom-post-type-${VERSION}.zip" page-for-custom-post-type) | |
| - name: Upload zip to release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TAG: ${{ needs.release-please.outputs.tag_name }} | |
| VERSION: ${{ needs.release-please.outputs.version }} | |
| run: gh release upload "$TAG" "page-for-custom-post-type-${VERSION}.zip" --clobber |