Skip to main content
Help Center

Managed WooCommerce Stores Help

Set up GitHub for automatic deployments to your Managed WooCommerce Stores site

As a best practice, use a version control system like GitHub to automatically deploy code changes. Follow these steps to set up GitHub for automatic deployments to your Managed WooCommerce Stores site.

Before you begin, here are a couple of things to keep in mind when setting up automatic deployments:

  • Always test on a staging site first: For any deployment process, invalid configurations, typos, and other problems are always possible. Always test automatic deployments on a staging site before targeting your Managed WooCommerce Stores production site.
  • Make sure that your GitHub environment matches the site environment: If your WordPress site's files differ from what's inside version control, you could lose data when the deployment runs. For more info, see our article on setting up your Git repository.
  • Finally, complete the steps to set up a Git deployment. You'll take care of this on your Managed WooCommerce Stores Overview page.
Note: Storing your integration secret as a secret in GitHub prevents your key from displaying inside your logs or action pipelines. For security, put your deploy tokens or credentials inside a GitHub secret, even if it's a private repository.

Set up GitHub for automatic deployments

  1. Log in to your GitHub repository.
  2. At the top right of the page, select Settings.
  3. In the Settings page, in the left-side menu select Secrets.
  4. At the top right of the page, select New secret.
  5. In the Name field, enter a name for the secret (for example, MWCS_INTEGRATION_SECRET).
  6. In the Value field, paste the Integration Secret from the Git integration you created in your Managed WooCommerce Stores Overview page.
  7. Select Add Secret.

Use this GitHub Action to deploy your code

For easy deployments, we've provided a GitHub Action that passes your variables over to a Docker container that does the rest of the work for you. Here's an example of a full GitHub Action pipeline configuration:


name: "mwcs-deploy"
on:
  push:
jobs:
  deploy:
    name: Deploy to MWCS
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout repo
        uses: actions/checkout@v2
      - name: Run deploy
        uses: godaddy-wordpress/mwcs-deploy-action@v1
        with:
          MWCS_DEPLOY_DEST: "/httpdocs"
          MWCS_INTEGRATION_SECRET: ${{secrets.MWCS_INTEGRATION_SECRET}}
          MWCS_INTEGRATION_ID: "HhYn7RelGEiYFJz7nzvKl9"
          MWCS_APP_ID: "12345"
          MWCS_WORKING_DIR: ${{github.workspace}}
          

If you're already familiar with GitHub Actions, drop this example into your workflow's YAML file and customize the variables as needed. To learn more, see Deployment docker image reference.

More info