Skip to content

semaphoreci-demos/semaphore-demo-zeit-now

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Semaphore demo CI/CD pipeline with Zeit Now

Example how to build an API serverless function and deploy it to Zeit Now using Semaphore.

CI/CD on Semaphore

  1. Fork this repository and use it to create a project.

  2. Go to your Now dashboard, and add a token. You should see a slightly hidden field in the middle of the page that says "Create a new token by entering its name..." I'd recommend calling it something obvious like zeit-now-semaphoreci-yourproject.

  3. Take the token, and create an Secret and add an Environment Variable in your project's configuration in SemaphoreCI. This sample repo calls the Secret now and Environment Variable ZEIT_TOKEN, CI pipeline on Semaphore so I'd suggest doing the same - if you change it, be aware that you'll need to change references to this token name in the sample files.

The CI pipeline will look like this:

CI pipeline on Semaphore

The example pipeline contains 3 blocks:

  • Install dependencies
    • installs and caches all npm dependencies
  • Run tests
  • Deploy

Local project setup

Installation

$ npm install

Running the app

$ npm install -g now
$ npm start

Test

$ npm test

Deploy

$ npm install -g now
$ now login
$ now deploy

License

Copyright (c) 2019 Rendered Text

Distributed under the MIT License. See the file LICENSE.md.