diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 366ec25..f1e3a3b 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -4,6 +4,13 @@ on: push: branches: - main + # semantic-release commits the new version to package.json with the workflow + # token, which starts no push workflow. Redeploy after every successful Release + # run on main so the stamped version below is the published one. + workflow_run: + workflows: ['Release'] + types: [completed] + branches: [main] workflow_dispatch: permissions: @@ -15,6 +22,10 @@ concurrency: jobs: deploy: + # Deploy after a successful Release run triggered by a push to main only. + if: >- + github.event_name != 'workflow_run' || + (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push') environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -28,6 +39,13 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + - name: Stamp the package version + # The site source never hardcodes the version: JSON-LD and llms.txt carry + # __PACKAGE_VERSION__, replaced here with the version from package.json. + run: | + version="$(node -p "require('./package.json').version")" + grep -rl --include='*.html' --include='*.txt' '__PACKAGE_VERSION__' docs/site | xargs -r sed -i "s/__PACKAGE_VERSION__/${version}/g" + if grep -rq '__PACKAGE_VERSION__' docs/site; then echo 'Unreplaced version token in docs/site' >&2; exit 1; fi - name: Configure GitHub Pages uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 - name: Upload site artifact diff --git a/docs/site/index.html b/docs/site/index.html index d732d3f..6db1cbd 100644 --- a/docs/site/index.html +++ b/docs/site/index.html @@ -66,6 +66,7 @@ "name": "MagicMail", "alternateName": "strapi-plugin-magic-mail", "description": "Free Strapi 5 plugin that sends every Strapi email through several SMTP and API accounts with routing rules, quotas, failover that never doubles a mail, an outbox with retries, templates and analytics.", + "softwareVersion": "__PACKAGE_VERSION__", "applicationCategory": "DeveloperApplication", "applicationSubCategory": "Strapi plugin", "operatingSystem": "Node.js 22+ / Strapi 5", diff --git a/docs/site/llms.txt b/docs/site/llms.txt index 0ec8e18..be58ad7 100644 --- a/docs/site/llms.txt +++ b/docs/site/llms.txt @@ -2,7 +2,7 @@ > MagicMail (npm: strapi-plugin-magic-mail) is a free, MIT-licensed Strapi 5 plugin that sends every Strapi email through several SMTP and API accounts, with routing rules, hourly and daily quotas, failover that never sends a mail twice, an outbox with retries, templates and a delivery log in the Strapi admin. -It sends email only. The current version is on npm (link below). +It sends email only. Current version: __PACKAGE_VERSION__ (npm). What it does: