Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

kameshsampath/drone-vercel-deploy

Repository files navigation

Drone Plugin to Deploy to Vercel

A Drone plugin to deploy a an application to Vercel.

Usage

The following settings changes this plugin's behavior.

  • vercel_token: The Vercel Token to use
  • vercel_org_id: The organization id to use with Vercel deployment
  • vercel_project_id The Vercel Project Name or ID.
  • vercel_project_create: (optional) If true then name of the project specified by vercel_project_id will be created and site will be deployed to that project. Defaults false.
  • vercel_environment: (optional) The vercel environment to deploy. It could be one of development, preview or production. Defaults to development
  • vercel_environment_variables: (optional) An array of KEY=VALUE pair of environment variables will be added to site project at vercel_environment scope.
  • vercel_environment_variable_file: (optional) An environment variable file, with each line being a KEY=VALUE pairs
  • log_level: If set to debug enable scripting debug

To use the plugin create a secret file called secret.local with following variables,

vercel_token=The Vercel token to use
vercel_project_id=The Vercel project Id
vercel_org_id=The Vercel Organization Id

Create a .drone.yml as shown below and then run the command drone exec --secret-file=.secret.local

kind: pipeline
type: docker
name: default
platform:
  os: linux
  arch: amd64
steps:
- name: deploy
  image: docker.io/kameshsampath/drone-vercel-deploy
  pull: never
  settings:
    log_level: debug
    # valid values are production, development, preview
    vercel_env: production
    vercel_token:
      from_secret: vercel_token
    vercel_org_id:
      from_secret: vercel_org_id
    vercel_project_id:
      from_secret: vercel_project_id
    vercel_project_create: true
    vercel_environment:
    - NEXT_PUBLIC_FOO=BAR
    - NEXT_PUBLIC_XMAS=25 Dec

Building

Run the following command to build and push the image manually

make build-and-load

To build and push the image use,

make build-and-push

Testing

To use the plugin create a secret file called secret.local ,

cd $PROJECT_HOME/examples
cp secret.example secret.local

Update the secret.local with values for,

  • vercel_token
  • vercel_org_id
  • vercel_project_id
drone exec --secret-file=secret.local .drone.yml