Velo: Set Up GitHub Actions to Work with the Wix CLI

To enable a GitHub Actions workflow to perform actions on your Wix site, the workflow must set up and authenticate the Wix CLI using an API key.

Prerequisites

Before creating a GitHub Action workflow to interact with your site, make sure that you integrate your site with GitHub.

Note: You can also Set up GitHub integration with the Wix CLI locally.

Set up GitHub Actions to work with your site

To authorize a GitHub Actions workflow to interact with your site, follow these steps:

Step 1 | Generate an API key

An API key allows an authorized external client to access your Wix account and site data. With an API key, you can authorize GitHub Actions to execute Wix CLI commands for your site.

You can generate an API key in the API Keys Manager. Select the Wix CLI - Git Integration site permission to allow GitHub Actions to use the Wix CLI for your sites.

Step 2 | Store the API key as a GitHub secret

Visit your site's GitHub repo and create a repository secret to store the API key. This makes your API key available to use securely in your repo's GitHub Actions workflows.

Step 3 | Set up the Wix CLI in your GitHub Actions workflow

Configure your GitHub Actions workflow to set up and authenticate the Wix CLI:

  1. In your GitHub Actions workflow, set up the Wix CLI by including the following command:

    Copy
  2. Next, authenticate it by including the following command:

    Copy

Step 4 | Include Wix CLI commands

Your workflow can now run authenticated Wix CLI commands to interact with your site. For example:

  • Include npm run wix preview in your workflow to build a preview version of the site based on the current branch. You can set up a workflow to create a preview version whenever a new PR is created.
  • Include npm run wix publish in your workflow to publish the site based on the repo's default branch. You can set up a workflow whenever a PR is merged to the default branch.

See also

Did this help?