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.
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.
To authorize a GitHub Actions workflow to interact with your site, follow these steps:
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.
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.
Configure your GitHub Actions workflow to set up and authenticate the Wix CLI:
In your GitHub Actions workflow, set up the Wix CLI by including the following command:
Next, authenticate it by including the following command:
Your workflow can now run authenticated Wix CLI commands to interact with your site. For example:
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.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.