Skip to content

ci: add demo WordPress deployment workflow#53

Open
ogorzalka wants to merge 5 commits into
developfrom
ci/deploy-demo
Open

ci: add demo WordPress deployment workflow#53
ogorzalka wants to merge 5 commits into
developfrom
ci/deploy-demo

Conversation

@ogorzalka
Copy link
Copy Markdown
Collaborator

@ogorzalka ogorzalka commented May 7, 2026

Summary

  • Adds a GitHub Actions workflow that deploys a full WordPress demo site on merge to develop
  • Uses WP-CLI to install WordPress, import theme unit test content, and configure the Axeptio plugin
  • Deploys to wordpress-qa.axept.io (63.34.106.0)

What it does

  1. Build job: builds plugin assets (Node + Composer production)
  2. Deploy job: SSH to server → install/update WordPress → deploy plugin → configure Axeptio settings
  3. Verifies the site responds after deployment

Secrets required

All secrets have been configured:

  • DEMO_SSH_PRIVATE_KEY, DEMO_MYSQL_USER, DEMO_MYSQL_PASS
  • DEMO_WP_ADMIN_USER, DEMO_WP_ADMIN_PASSWORD, DEMO_WP_ADMIN_EMAIL
  • DEMO_AXEPTIO_CLIENT_ID, DEMO_AXEPTIO_VERSION

Test plan

Deploys a full WordPress demo site on merge to develop.
Uses WP-CLI to install WordPress, import demo content,
and configure the Axeptio plugin on the QA server.
Copilot AI review requested due to automatic review settings May 7, 2026 09:14
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6c0f0d6ece

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/deploy-demo.yml Outdated
MYSQL_USER: ${{ secrets.DEMO_MYSQL_USER }}
MYSQL_PASS: ${{ secrets.DEMO_MYSQL_PASS }}
run: |
ssh ${{ env.DEMO_USER }}@${{ env.DEMO_HOST }} bash -s << 'DEPLOY_SCRIPT'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pass secrets into the remote deploy shell

When this step runs, the secrets declared in the step env exist only in the GitHub runner process. This SSH invocation starts a fresh remote bash without forwarding those variables, and the quoted heredoc prevents local expansion, so set -u will abort on the first remote use such as ${MYSQL_DB} before WordPress is deployed. Pass the required values as environment assignments to ssh/bash or otherwise render them safely into the remote script.

Useful? React with 👍 / 👎.

Comment thread .github/workflows/deploy-demo.yml Outdated
rm -f /tmp/plugin.tar.gz

# --- Activate plugin --------------------------------------------------
sudo -u www-data wp plugin activate "${PLUGIN_SLUG}" --path="$WP_PATH"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Install the required plugin before activating Axeptio

On a fresh demo site this activation runs before wp-consent-api is installed, but axeptio-wordpress-plugin.php declares Requires Plugins: wp-consent-api. WordPress 6.5's dependency handling also affects WP-CLI: “dependent plugins cannot be activated using WP-CLI until their dependencies are activated,” so this command fails until the companion plugin is installed and active; move the wp-consent-api install/activate step before activating Axeptio.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new GitHub Actions workflow to automatically build and deploy a demo WordPress site (including this plugin) to the wordpress-qa.axept.io server on pushes to develop, using SSH + WP-CLI for installation/configuration.

Changes:

  • Introduces a CI workflow that builds production JS/PHP assets and packages the plugin as an artifact.
  • Adds a deploy job that uploads the plugin to a remote host and runs WP-CLI commands to install/update WordPress and configure Axeptio settings.
  • Adds a simple post-deploy HTTP status check.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/deploy-demo.yml Outdated
Comment on lines +70 to +72
with:
sparse-checkout: |
.github/scripts
Comment thread .github/workflows/deploy-demo.yml Outdated
Comment on lines +80 to +86
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEMO_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ env.DEMO_HOST }} >> ~/.ssh/known_hosts

Comment thread .github/workflows/deploy-demo.yml Outdated
Comment on lines +101 to +108
run: |
ssh ${{ env.DEMO_USER }}@${{ env.DEMO_HOST }} bash -s << 'DEPLOY_SCRIPT'
set -euo pipefail

WP_PATH="${{ env.WP_PATH }}"
DOMAIN="${{ env.DEMO_DOMAIN }}"
PLUGIN_SLUG="${{ env.PLUGIN_SLUG }}"
PLUGIN_FILE="${{ env.PLUGIN_FILE }}"
Comment thread .github/workflows/deploy-demo.yml Outdated
Comment on lines +118 to +121
sudo mysql -e "CREATE DATABASE IF NOT EXISTS ${MYSQL_DB} CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
sudo mysql -e "CREATE USER IF NOT EXISTS '${MYSQL_USER}'@'localhost' IDENTIFIED BY '${MYSQL_PASS}';"
sudo mysql -e "GRANT ALL PRIVILEGES ON ${MYSQL_DB}.* TO '${MYSQL_USER}'@'localhost'; FLUSH PRIVILEGES;"

Comment thread .github/workflows/deploy-demo.yml Outdated
Comment on lines +105 to +108
WP_PATH="${{ env.WP_PATH }}"
DOMAIN="${{ env.DEMO_DOMAIN }}"
PLUGIN_SLUG="${{ env.PLUGIN_SLUG }}"
PLUGIN_FILE="${{ env.PLUGIN_FILE }}"
Comment thread .github/workflows/deploy-demo.yml Outdated
Comment on lines +112 to +114
curl -sO https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
Comment on lines +231 to +235
HTTP_STATUS=$(curl -sk -o /dev/null -w "%{http_code}" "https://${{ env.DEMO_DOMAIN }}")
if [ "$HTTP_STATUS" -ge 200 ] && [ "$HTTP_STATUS" -lt 400 ]; then
echo "✅ Demo site responding with HTTP $HTTP_STATUS"
else
echo "❌ Demo site returned HTTP $HTTP_STATUS"
ogorzalka added 2 commits May 7, 2026 11:29
Instead of SSH from GitHub runners, the workflow:
1. Builds and zips the plugin
2. Uploads the zip to the server via HTTPS
3. Triggers a webhook that starts the deploy via systemd
Copilot AI review requested due to automatic review settings May 7, 2026 09:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment on lines +75 to +80
curl -sk --fail \
-X PUT \
-H "Host: ${{ env.DEMO_DOMAIN }}" \
-H "X-Webhook-Signature: ${SIGNATURE}" \
--data-binary @/tmp/plugin.zip \
"https://${{ env.DEMO_IP }}/deploy-artifact.php"
Comment on lines +102 to +113
- name: Wait for deployment
run: sleep 30

- name: Verify deployment
run: |
HTTP_STATUS=$(curl -sk -o /dev/null -w "%{http_code}" "https://${{ env.DEMO_DOMAIN }}")
if [ "$HTTP_STATUS" -ge 200 ] && [ "$HTTP_STATUS" -lt 400 ]; then
echo "✅ Demo site responding with HTTP $HTTP_STATUS"
else
echo "❌ Demo site returned HTTP $HTTP_STATUS"
exit 1
fi
Comment on lines +3 to +6
on:
push:
branches: [develop, ci/deploy-demo]
workflow_dispatch:

- name: Upload plugin zip to server
run: |
SIGNATURE="sha256=$(echo -n "@/tmp/plugin.zip" | openssl dgst -sha256 -hmac "${{ secrets.DEMO_WEBHOOK_SECRET }}" | awk '{print $2}')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants