|
1 | 1 | # Vercel Deploy
|
2 | 2 |
|
3 |
| -Strapi v4 plugin to trigger and monitor a deployment on Vercel |
| 3 | +Strapi v4 plugin to trigger and monitor a deployment on Vercel. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +## Plugin Preview |
| 8 | + |
| 9 | +Home Page: |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +Settings Page: |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +## Installation |
| 18 | + |
| 19 | +### Install dependency |
| 20 | + |
| 21 | +Run the following command in your Strapi project to install vercel-deploy: |
| 22 | + |
| 23 | +```shell |
| 24 | +yarn add strapi-plugin-vercel-deploy |
| 25 | +# or |
| 26 | +npm i -S strapi-plugin-vercel-deploy |
| 27 | +``` |
| 28 | + |
| 29 | +### Enable plugin configuration |
| 30 | + |
| 31 | +Open `config/plugins.js` file and add the vercel-deploy entry: |
| 32 | + |
| 33 | +``` |
| 34 | +module.exports = ({ env }) => ({ |
| 35 | + "vercel-deploy": { |
| 36 | + enabled: true, |
| 37 | + }, |
| 38 | +}); |
| 39 | +
|
| 40 | +``` |
| 41 | + |
| 42 | +### Run |
| 43 | + |
| 44 | +You can now run Strapi: |
| 45 | + |
| 46 | +``` |
| 47 | +yarn develop |
| 48 | +``` |
| 49 | + |
| 50 | +You should see the **Vercel Deploy** menu in the left panel. |
| 51 | + |
| 52 | +**N.B.** You _may_ need to run `yarn build` in order to see the new menu entries. |
| 53 | + |
| 54 | +Then you can proceed with the environment config |
4 | 55 |
|
5 | 56 | ## Environment Conifg
|
6 | 57 |
|
7 |
| -In order to use the plugin, you need to set the following environment variables: |
| 58 | +### Config properties |
| 59 | + |
| 60 | +The plugin is reading the following environment variable to work: |
8 | 61 |
|
9 | 62 | - `VERCEL_DEPLOY_PLUGIN_HOOK`: Url of the git deploy hook exposed in Vercel.
|
| 63 | + |
10 | 64 | - You can follow [this](https://vercel.com/docs/git/deploy-hooks) guide to create a deploy hook on Vercel
|
11 |
| - - Then you can save the hook url as process env variable (e.g. [this](https://devcenter.heroku.com/articles/config-vars) guide is for Heroku) |
12 | 65 |
|
13 |
| -- `VERCEL_DEPLOY_PLUGIN_API_TOKEN`: API token of your Vercel account used to fetch the list of deployments |
| 66 | +- `VERCEL_DEPLOY_PLUGIN_API_TOKEN`: API token of your Vercel account used to fetch the list of deployments |
| 67 | + |
14 | 68 | - Access tokens can be created and managed inside your [account settings](https://vercel.com/account/tokens)
|
15 |
| - - Then you can save the hook url as process env variable (e.g. [this](https://devcenter.heroku.com/articles/config-vars) guide is for Heroku) |
16 | 69 |
|
17 | 70 | - `VERCEL_DEPLOY_PLUGIN_APP_FILTER`: Name of your Vercel App used to filter the list of deployments
|
18 | 71 | - Set the name of your [Vercel App](https://vercel.com/dashboard) to see only the deployments you need
|
19 |
| - - Then you can save the hook url as process env variable (e.g. [this](https://devcenter.heroku.com/articles/config-vars) guide is for Heroku) |
20 | 72 |
|
| 73 | +### Local development |
| 74 | + |
| 75 | +For local development, you can add the config properties in your `.env` file: |
| 76 | + |
| 77 | +``` |
| 78 | +VERCEL_DEPLOY_PLUGIN_HOOK="https://api.vercel.com/v1/integrations/deploy/prj_<deploy-hook>" |
| 79 | +VERCEL_DEPLOY_PLUGIN_API_TOKEN="<vercel-api-token>" |
| 80 | +VERCEL_DEPLOY_PLUGIN_APP_FILTER="your-app-name-on-vercel" |
| 81 | +``` |
| 82 | + |
| 83 | +### Server |
| 84 | + |
| 85 | +You can save these values as process env variable on your server (e.g. [this](https://devcenter.heroku.com/articles/config-vars) guide is for Heroku). |
0 commit comments