Skip to content

Deploy Bedrock

Deploys a WordPress/Bedrock site by SSH'ing to the server through Cloudflare Access, updating the git checkout and running the site's devops/deployment-script/deployment-script.sh.

Inputs

Input Default Description
environment Required develop deploys to the staging server, master deploys to production
ref "" Branch to deploy on staging. Only used when environment is develop; empty means the develop branch. Production rejects any value other than master

Deploying a feature branch to staging

Expose a ref input on the project's workflow_dispatch and pass it through:

on:
  workflow_dispatch:
    inputs:
      environment:
        type: choice
        options: [develop, master]
      ref:
        description: "Branch to deploy (develop only, defaults to develop)"
        required: false
        type: string

jobs:
  deploy:
    uses: subscribed-aps/workflows/.github/workflows/deploy-bedrock.yml@main
    with:
      environment: ${{ inputs.environment }}
      ref: ${{ inputs.ref }}
    secrets: inherit

Run the workflow with environment: develop and ref: feature/my-branch. The staging checkout switches to that branch and stays there until the next develop deploy, which switches back to develop.

Notes:

  • Only branches that exist on origin can be deployed. Tags and commit SHAs are rejected, both by the name check in the workflow and by a refs/remotes/origin/<ref> check on the server.
  • The server is fast-forwarded only. If the branch was force-pushed after a previous deploy, the deploy fails and the server branch has to be reset by hand.
  • Production always deploys master. Passing a different ref with environment: master fails the run before anything touches the server.