Giter Site home page Giter Site logo

shubham-21-dev / strapi-plugin-vercel-deploy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gianlucaparadise/strapi-plugin-vercel-deploy

0.0 0.0 0.0 2.11 MB

Strapi v4 plugin to trigger and monitor a deployment on Vercel

License: MIT License

Shell 0.17% JavaScript 99.83%

strapi-plugin-vercel-deploy's Introduction

Vercel Deploy

npm version strapi market link

Strapi v4 plugin to trigger and monitor a deployment on Vercel.

Vercel Deploy Logo

Plugin Preview

Home Page:

Plugin Home Page

Settings Page:

Plugin Settings Page

Installation

Install dependency

Run the following command in your Strapi project to install vercel-deploy:

yarn add strapi-plugin-vercel-deploy
# or
npm i -S strapi-plugin-vercel-deploy

Enable plugin configuration

Open config/plugins.js file and add the vercel-deploy entry:

module.exports = ({ env }) => ({
  "vercel-deploy": {
    enabled: true,
  },
});

Run

You can now run Strapi:

yarn develop

You should see the Vercel Deploy menu in the left panel.

N.B. You may need to run yarn build in order to see the new menu entries.

Then you can proceed with the plugin configuration.

Plugin Configuration

Config properties

Example:

module.exports = ({ env }) => ({
  "vercel-deploy": {
    enabled: true,
    config: {
      deployHook:
        "https://api.vercel.com/v1/integrations/deploy/prj_<deploy-hook>",
      apiToken: "<vercel-api-token>",
      appFilter: "your-app-name-on-vercel",
      teamFilter: "your-team-id-on-vercel",
      roles: ["strapi-super-admin", "strapi-editor", "strapi-author"],
    },
  },
});

The plugin is reading the following configuration variables to work:

  • deployHook: Url of the git deploy hook exposed in Vercel.

    • You can follow this guide to create a deploy hook on Vercel
  • apiToken: API token of your Vercel account used to fetch the list of deployments

  • appFilter: Name of your Vercel App used to filter the list of deployments

    • Set the name of your Vercel App to see only the deployments you need
  • teamFilter: Id of your Vercel Team used to filter the list of deployments

    • Set the id of your Vercel Team to see only the deployments you need
  • roles: List of user roles that can use the plugin

    • Any user with at least one of the specified roles can use the plugin. If the list is empty or undefined, any user can use the plugin.

Environment Configuration

You shouldn't disclose the api token and the deploy hook url for security reasons. Therefore, you shouldn't add these values to versioning in a public git repository. A suggested solution is to use environment variables. Example:

module.exports = ({ env }) => ({
  "vercel-deploy": {
    enabled: true,
    config: {
      deployHook: process.env.VERCEL_DEPLOY_PLUGIN_HOOK,
      apiToken: process.env.VERCEL_DEPLOY_PLUGIN_API_TOKEN,
      appFilter: process.env.VERCEL_DEPLOY_PLUGIN_APP_FILTER,
      teamFilter: process.env.VERCEL_DEPLOY_PLUGIN_TEAM_FILTER,
      roles: ["strapi-super-admin"],
    },
  },
});

Local development

For local development, you can add the config properties in your .env file:

VERCEL_DEPLOY_PLUGIN_HOOK="https://api.vercel.com/v1/integrations/deploy/prj_<deploy-hook>"
VERCEL_DEPLOY_PLUGIN_API_TOKEN="<vercel-api-token>"
VERCEL_DEPLOY_PLUGIN_APP_FILTER="your-app-name-on-vercel"

Server

You can save these values as process env variable on your server (e.g. this guide is for Heroku).

strapi-plugin-vercel-deploy's People

Contributors

gianlucaparadise avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.