From 2f54c1072b79039ba5f079650a633071259be651 Mon Sep 17 00:00:00 2001 From: Schero94 <64200582+Schero94@users.noreply.github.com> Date: Fri, 20 Nov 2026 00:31:45 +0100 Subject: [PATCH] ci: stamp the package version into the Pages site at deploy The docs site source names no version. pages.yml now replaces the token __PACKAGE_VERSION__ in docs/site (JSON-LD softwareVersion and llms.txt) with the version from package.json and fails if a token is left. semantic-release commits the new version with the workflow token, which starts no push workflow, so Pages also redeploys on workflow_run after a successful "Release" run that a push to main triggered. The job checks out the default branch (no pull request code), keeps contents: read plus pages: write and id-token: write, and actions stay as they were. Checked with actionlint 1.7.12. Docs read 2026-11-20: GitHub "Events that trigger workflows" (workflow_run runs the default-branch workflow with GITHUB_SHA at the last default-branch commit; branches filter; check github.event.workflow_run.conclusion). Co-Authored-By: Claude Opus 5.5 --- .github/workflows/pages.yml | 18 ++++++++++++++++++ docs/site/index.html | 1 + docs/site/llms.txt | 2 ++ 3 files changed, 21 insertions(+) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index dfe06b1..59cb0c7 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -9,6 +9,13 @@ on: paths: - 'docs/site/**' - '.github/workflows/pages.yml' + # 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: @@ -20,6 +27,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') runs-on: ubuntu-latest timeout-minutes: 10 permissions: @@ -34,6 +45,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 ea46080..2e9ac9d 100644 --- a/docs/site/index.html +++ b/docs/site/index.html @@ -50,6 +50,7 @@ "name": "Magic MessageGate", "alternateName": "strapi-plugin-magic-messagegate", "description": "Free Strapi 5 plugin for WhatsApp (Meta Cloud API), RCS (Twilio), Telegram and SMS: templates and attachments, exactly-once sending, delivery and read tracking, inbound replies and files, a fallback chain, consent and GDPR tools.", + "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 292bbc8..e315397 100644 --- a/docs/site/llms.txt +++ b/docs/site/llms.txt @@ -2,6 +2,8 @@ > Strapi 5 plugin (npm: strapi-plugin-magic-messagegate, plugin id: magic-messagegate) that sends and receives messages over WhatsApp (Meta Cloud API), RCS (Twilio), Telegram (Bot API) and SMS (seven.io, Twilio): send -> receive -> process -> automate. It has a durable exactly-once outbox, attachments, delivery and read tracking, inbound messages with buttons and files, a fallback chain (WhatsApp -> RCS -> SMS; e-mail through Magic Mail only when enabled), per-channel consent with STOP keywords, number checks, a dry run, a sandbox mode for tests, and an admin built from the Strapi Design System. +Current version: __PACKAGE_VERSION__ (npm). + Requirements: Strapi `^5.38.0`, Node.js `^22.21.0 || >=24.9.0 <=26.x.x`, PostgreSQL, MySQL 8 or SQLite. Install with `npm install strapi-plugin-magic-messagegate`; the current version is on npm. MIT licensed; the providers charge for their messages. Key facts for code generation: