Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
ba965e2
feat(wordpress): settings page with PDF links report, page scoping an…
bendersej Sep 25, 2026
5288908
chore(wordpress): keep the published web-embed-pdf 1.8.4 bundle until…
bendersej Sep 25, 2026
02a8ce5
feat(wordpress): one-time review notice once a PDF opens in SimplePDF…
bendersej Sep 25, 2026
f85f5fe
chore(wordpress): bundle @simplepdf/web-embed-pdf 1.9.0
bendersej Sep 28, 2026
0006fdf
fix(wordpress): one form per card, links read like a browser, the sha…
bendersej Sep 28, 2026
3290653
feat(wordpress): AI assistants card (WebMCP on by default, off switch…
bendersej Sep 28, 2026
44828c5
fix(wordpress): review round (card copy matches the switch, simplepdf…
bendersej Sep 28, 2026
641f5f8
fix(wordpress): keep the web package's tests out of the release, shar…
bendersej Sep 28, 2026
a9b2f7b
feat(wordpress): 1.2.0 readme (outcome-led description, settings prev…
bendersej Sep 28, 2026
dc1c4ed
feat(wordpress): light-blue header band on the Get started state
bendersej Sep 28, 2026
7ed6d05
feat(wordpress): Get started heading and copy on the empty state
bendersej Sep 28, 2026
7755fab
feat(wordpress): AI assistants as one checkbox in Where it runs, acco…
bendersej Sep 28, 2026
5681176
feat(wordpress): Excel export chip, submissions dashboard as listing …
bendersej Sep 28, 2026
7b1889d
feat(wordpress): Excel export leads the account chips
bendersej Sep 28, 2026
8cbe5fe
docs(wordpress): settings previews under descriptive names
bendersej Sep 28, 2026
6209b2b
ci(wordpress): announce plugin releases on Discord once WordPress.org…
bendersej Sep 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/wordpress-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: WordPress release

# Run by hand once the SVN tag is committed: WordPress.org releases happen outside GitHub.
on:
workflow_dispatch:

jobs:
announce:
name: Announce the plugin release on Discord
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "24"

- name: Announce the release
run: node scripts/announce-wordpress-release.mjs
env:
DISCORD_RELEASES_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASES_WEBHOOK_URL }}
55 changes: 55 additions & 0 deletions .github/workflows/wordpress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: WordPress

on:
pull_request:
branches:
- main
paths:
- wordpress/**
- .github/workflows/wordpress.yaml

jobs:
test:
name: Plugin on PHP ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
matrix:
# 5.6 is the plugin's "Requires PHP" floor (wordpress/svn/trunk/README.txt).
php: ["5.6", "8.3"]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Lint the plugin
run: |
for file in wordpress/svn/trunk/*.php; do
docker run --rm -v "$PWD":/w php:${{ matrix.php }}-cli php -l "/w/$file"
done

- name: Test the PDF link rule against the shared cases
run: docker run --rm -v "$PWD":/w php:${{ matrix.php }}-cli php /w/wordpress/tests/pdf-links-test.php

vendored-bundle:
name: Vendored web-embed matches the pinned version
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Re-vendor from npm and compare
working-directory: wordpress
run: |
npm ci
npm run copy-src
npm run copy-build
npm run copy-fixtures
git diff --exit-code -- svn/trunk/src svn/trunk/build tests/fixtures
test -z "$(git status --porcelain -- svn/trunk/src svn/trunk/build tests/fixtures)"

- name: The plugin enqueues the pinned version
working-directory: wordpress
run: |
pinned_version=$(node -p "require('./package.json').dependencies['@simplepdf/web-embed-pdf']")
grep -q "define('SIMPLEPDF_WEB_EMBED_VERSION', '${pinned_version}');" svn/trunk/simplepdf-embed.php
6 changes: 3 additions & 3 deletions scripts/announce-release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export const EXIT_CODES = {
discord_rejected_message: 4,
}

const BRAND_BLUE = 0x3665e1
export const BRAND_BLUE = 0x3665e1
const BREAKING_RED = 0xcc2222
const LOGO_URL = 'https://simplepdf.com/android-chrome-512x512.png'
export const LOGO_URL = 'https://simplepdf.com/android-chrome-512x512.png'
// Discord caps an embed description at 4096 characters; the headroom keeps the closing link line.
const DESCRIPTION_LIMIT = 3800

Expand Down Expand Up @@ -170,7 +170,7 @@ const parsePublishedPackages = (value) => {
}
}

const postToDiscord = async ({ webhookUrl, message }) => {
export const postToDiscord = async ({ webhookUrl, message }) => {
const response = await fetch(webhookUrl, {
method: 'POST',
headers: { 'content-type': 'application/json' },
Expand Down
120 changes: 120 additions & 0 deletions scripts/announce-wordpress-release.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// Posts a WordPress plugin release to the Discord releases channel, from the changelog in README.txt.
// The plugin ships through WordPress.org SVN, which GitHub never sees: the "WordPress release" workflow is run by
// hand after the SVN commit, and this script refuses to post until WordPress.org serves the Stable tag.
// Usage: DISCORD_RELEASES_WEBHOOK_URL=… node scripts/announce-wordpress-release.mjs (DRY_RUN=1 prints the message)
import { readFile } from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { BRAND_BLUE, LOGO_URL, postToDiscord } from './announce-release.mjs'

export const EXIT_CODES = {
success: 0,
stable_tag_not_found: 2,
changelog_section_not_found: 3,
discord_rejected_message: 4,
wordpress_org_unreachable: 5,
not_live_on_wordpress_org: 6,
}

const PLUGIN_URL = 'https://wordpress.org/plugins/simplepdf-embed/'
const PLUGIN_INFO_URL = 'https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&slug=simplepdf-embed'
const SOURCE_URL = 'https://github.com/SimplePDF/simplepdf-embed/tree/main/wordpress'

// The Stable tag and its `= <version> =` changelog bullets, or null without a Stable tag.
export const parseReadme = (readme) => {
const version = /^Stable tag:\s*(\S+)\s*$/m.exec(readme)?.[1] ?? null
if (version === null) {
return null
}

const lines = readme.split('\n')
const changelogStart = lines.findIndex((line) => line.trim() === '== Changelog ==')
const versionStart = lines.findIndex((line, index) => index > changelogStart && line.trim() === `= ${version} =`)
if (changelogStart === -1 || versionStart === -1) {
return { version, entries: [] }
}

const sectionLines = lines.slice(versionStart + 1)
const end = sectionLines.findIndex((line) => line.trim().startsWith('='))
const entries = (end === -1 ? sectionLines : sectionLines.slice(0, end))
.filter((line) => line.startsWith('* '))
.map((line) => line.slice(2).trim())

return { version, entries }
}

export const buildWordPressReleaseMessage = ({ version, entries }) => ({
username: 'SimplePDF Releases',
avatar_url: LOGO_URL,
allowed_mentions: { parse: [] },
embeds: [
{
title: `SimplePDF Embed for WordPress ${version}`,
url: PLUGIN_URL,
color: BRAND_BLUE,
description: ["**What's new**", ...entries.map((entry) => `- ${entry}`)].join('\n'),
fields: [
{
name: 'Get started',
value: 'New site: Plugins > Add New, search for "SimplePDF Embed".\nAlready installed: update from Dashboard > Updates.',
},
{ name: 'Links', value: `[Plugin page](${PLUGIN_URL}) · [Changelog](${PLUGIN_URL}#developers) · [Source](${SOURCE_URL})` },
],
footer: { text: 'SimplePDF · GPLv2 or later', icon_url: LOGO_URL },
timestamp: new Date().toISOString(),
},
],
})

const fetchLiveVersion = async () => {
try {
const response = await fetch(PLUGIN_INFO_URL)
const pluginInfo = response.ok ? await response.json() : null
return typeof pluginInfo?.version === 'string' ? pluginInfo.version : null
} catch {
return null
}
}

const main = async () => {
const rootDir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..')
const readme = await readFile(path.join(rootDir, 'wordpress/svn/trunk/README.txt'), 'utf8')
const release = parseReadme(readme)
if (release === null) {
console.error('wordpress/svn/trunk/README.txt has no Stable tag')
return EXIT_CODES.stable_tag_not_found
}
if (release.entries.length === 0) {
console.error(`README.txt has no "= ${release.version} =" changelog entries`)
return EXIT_CODES.changelog_section_not_found
}

const message = buildWordPressReleaseMessage(release)
const webhookUrl = process.env.DISCORD_RELEASES_WEBHOOK_URL
if (webhookUrl === undefined || webhookUrl === '' || process.env.DRY_RUN === '1') {
console.log(JSON.stringify(message, null, 2))
return EXIT_CODES.success
}

const liveVersion = await fetchLiveVersion()
if (liveVersion === null) {
console.error(`Could not read the live version from ${PLUGIN_INFO_URL}`)
return EXIT_CODES.wordpress_org_unreachable
}
if (liveVersion !== release.version) {
console.error(`WordPress.org serves ${liveVersion}, not ${release.version}: commit the SVN tag first, then run this again`)
return EXIT_CODES.not_live_on_wordpress_org
}

const failure = await postToDiscord({ webhookUrl, message })
if (failure !== null) {
console.error(`Discord rejected the announcement for ${release.version}: ${failure}`)
return EXIT_CODES.discord_rejected_message
}
console.log(`Announced SimplePDF Embed for WordPress ${release.version}`)
return EXIT_CODES.success
}

if (process.argv[1] === fileURLToPath(import.meta.url)) {
process.exit(await main())
}
42 changes: 42 additions & 0 deletions scripts/announce-wordpress-release.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import { test } from 'node:test'
import { buildWordPressReleaseMessage, parseReadme } from './announce-wordpress-release.mjs'

const README = `=== SimplePDF Embed ===
Stable tag: 1.2.0

== Changelog ==

= 1.2.0 =
* New settings page
* Update web-embed-pdf to 1.9.0

= 1.1.3 =
* An older fix
`

test('reads the Stable tag and only its changelog entries', () => {
assert.deepEqual(parseReadme(README), { version: '1.2.0', entries: ['New settings page', 'Update web-embed-pdf to 1.9.0'] })
assert.equal(parseReadme('=== SimplePDF Embed ===\n'), null)
assert.deepEqual(parseReadme(README.replace('= 1.2.0 =', '= 1.2.1 =')), { version: '1.2.0', entries: [] })
})

test('the committed readme has entries for its Stable tag', async () => {
const readme = await readFile(new URL('../wordpress/svn/trunk/README.txt', import.meta.url), 'utf8')
const release = parseReadme(readme)

assert.notEqual(release, null)
assert.ok(release.entries.length > 0)
})

test('the message links the plugin page, never pings, and lists every entry', () => {
const message = buildWordPressReleaseMessage(parseReadme(README))
const [embed] = message.embeds

assert.deepEqual(message.allowed_mentions, { parse: [] })
assert.equal(embed.title, 'SimplePDF Embed for WordPress 1.2.0')
assert.equal(embed.url, 'https://wordpress.org/plugins/simplepdf-embed/')
assert.equal(embed.description, "**What's new**\n- New settings page\n- Update web-embed-pdf to 1.9.0")
assert.match(embed.fields[1].value, /\[Plugin page\]\(https:\/\/wordpress\.org\/plugins\/simplepdf-embed\/\)/)
})
7 changes: 3 additions & 4 deletions wordpress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ brew install svn
svn checkout https://plugins.svn.wordpress.org/simplepdf-embed svn
```

1. Update the version of `@simplepdf/web-embed-pdf` in [simplepdf-embed.php](./svn/trunk/simplepdf-embed.php) to the one specified in [package.json](./package.json):
```
wp_enqueue_script('simplepdf-web-embed-pdf', $script_src, array(), '<VERSION>', true);
```
1. Set `SIMPLEPDF_WEB_EMBED_VERSION` in [simplepdf-embed.php](./svn/trunk/simplepdf-embed.php) to the `@simplepdf/web-embed-pdf` version pinned in [package.json](./package.json) (CI fails on a mismatch)

2. Update the TAG / version in [simplepdf-embed.php](./svn/trunk/simplepdf-embed.php)
3. Update the TAG / version in [README.txt](./svn/trunk/README.txt)
Expand All @@ -30,3 +27,5 @@ svn up
svn cp trunk tags/<TAG>
svn commit -m 'Tagging version <TAG>'
```

7. Once https://wordpress.org/plugins/simplepdf-embed/ shows the new version, announce it on Discord: run the **WordPress release** workflow (`gh workflow run wordpress-release.yaml --repo SimplePDF/simplepdf-embed`). It posts the `README.txt` changelog for the Stable tag, and refuses to post until WordPress.org serves that version.
34 changes: 29 additions & 5 deletions wordpress/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions wordpress/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"scripts": {
"copy-src": "cp -r ./node_modules/@simplepdf/web-embed-pdf/src/* ./svn/trunk/src/",
"copy-src": "rm -rf ./svn/trunk/src && cp -r ./node_modules/@simplepdf/web-embed-pdf/src ./svn/trunk/src && rm -rf ./svn/trunk/src/__tests__",
"copy-fixtures": "mkdir -p ./tests/fixtures && cp ./node_modules/@simplepdf/web-embed-pdf/src/__tests__/fixtures/pdf-link-cases.json ./tests/fixtures/",
"copy-build": "cp -r ./node_modules/@simplepdf/web-embed-pdf/dist/index.min.js ./svn/trunk/build/web-embed-pdf.js",
"package-plugin": "npm install && npm run copy-src && npm run copy-build"
"package-plugin": "npm install && npm run copy-src && npm run copy-build && npm run copy-fixtures"
},
"dependencies": {
"@simplepdf/web-embed-pdf": "^1.8.4"
"@simplepdf/web-embed-pdf": "1.9.0"
}
}
2 changes: 1 addition & 1 deletion wordpress/svn/assets/blueprints/blueprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"step": "installPlugin",
"pluginZipFile": {
"resource": "url",
"url": "https://downloads.wordpress.org/plugin/simplepdf-embed.1.1.3.zip"
"url": "https://downloads.wordpress.org/plugin/simplepdf-embed.1.2.0.zip"
},
"options": {
"activate": true
Expand Down
Binary file modified wordpress/svn/assets/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified wordpress/svn/assets/screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading