chore(release): 0.9.6 #75
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*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| name: Build and release plugin zip | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Validate tag shape | |
| id: validate | |
| # `on.push.tags` is a permissive glob (`v*`); this is the strict | |
| # gatekeeper. Non-strict tags exit successfully as a no-op. | |
| env: | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "Tag '$TAG' is a strict release tag — proceeding." | |
| echo "is_release=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Tag '$TAG' is not a strict v<major>.<minor>.<patch> tag — skipping release." | |
| echo "is_release=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Checkout | |
| if: steps.validate.outputs.is_release == 'true' | |
| uses: actions/checkout@v7 | |
| - name: Checkout newspack-nodes runtime (for the @newspack-nodes/runtime alias) | |
| if: steps.validate.outputs.is_release == 'true' | |
| uses: actions/checkout@v7 | |
| with: | |
| repository: Automattic/newspack-nodes | |
| # Pinned substrate tag — bump when adopting a newer substrate. | |
| ref: v2.43.1 | |
| path: .newspack-nodes | |
| - name: Setup PHP | |
| if: steps.validate.outputs.is_release == 'true' | |
| uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1 | |
| with: | |
| php-version: '8.2' | |
| tools: composer:v2 | |
| - name: Setup Node | |
| if: steps.validate.outputs.is_release == 'true' | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: '24' | |
| - name: Build release archive | |
| if: steps.validate.outputs.is_release == 'true' | |
| # npm ci: reproducible install from the committed lock; release:archive (build-release.sh) is the single source of truth for what ships. | |
| env: | |
| NEWSPACK_NODES_SRC: ${{ github.workspace }}/.newspack-nodes/src | |
| run: | | |
| npm ci --prefer-offline --no-audit --no-fund | |
| npm run release:archive | |
| - name: Extract changelog notes | |
| if: steps.validate.outputs.is_release == 'true' | |
| # Use the CHANGELOG section for this version as the release body, so the | |
| # published notes match the curated changelog rather than autogenerated | |
| # commit lists. GITHUB_REF_NAME is the built-in tag name (e.g. v0.2.43). | |
| run: | | |
| version="${GITHUB_REF_NAME#v}" | |
| awk -v ver="$version" ' | |
| $0 ~ ("^## \\[" ver "\\]") { flag=1; next } | |
| /^## \[/ && flag { exit } | |
| flag { print } | |
| ' CHANGELOG.md > RELEASE_NOTES.md | |
| if [[ ! -s RELEASE_NOTES.md ]]; then | |
| echo "No CHANGELOG.md section for ${version}; see CHANGELOG.md." > RELEASE_NOTES.md | |
| fi | |
| - name: Create GitHub Release | |
| if: steps.validate.outputs.is_release == 'true' | |
| uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0 | |
| with: | |
| files: | | |
| release/newspack-intelligence.zip | |
| body_path: RELEASE_NOTES.md | |
| fail_on_unmatched_files: true |