surge-preview

1.0.10 • Public • Published

surge-preview

Publish static assets to surge and sets a status to Github pull requests. Plays well with Drone, Circle or Travis CI.

CI Usage

Install it as an CI step: npm install surge-preview -g or yarn global add surge-preview

  1. Create a surge.sh account and install surge on your local machine
  2. Generate a Github Personal Access Token that is scoped to repo:status
  3. Generate a SURGE_TOKEN
  4. Set SURGE_LOGIN, SURGE_TOKEN and GITHUB_TOKEN in your CI environment
  5. Add surge-preview to your CI yaml file, specify your folder and call it after your assets are generated within the CI

You can specify any parameter as an atribute:

  Usage
    $ surge-preview <folder> [options]

  Inputs
    <folder>       Folder to be published, defaults to './dist'

  Options
    --domain       domain to publish, defaults to '#sha.surge.sh'
    --surge-login  surge login, defaults to 'env.SURGE_LOGIN'
    --surge-token  surge token, defaults to 'env.SURGE_TOKEN'
    --hash         commit hash, defaults to CI env
    --github-token Github Token, defaults to 'env.GITHUB_TOKEN'
    --repo         Github repository, defaults to CI env

Notes

  1. surge-preview is desigend as an optional CI step and will always exits with status 0 to keep the following CI steps running.

  2. In an CI aviod adding tokens or logins as parameters. Use CI environment variables to store them as a secret.

Remixes

Install and use it as a package dependency: npm install surge-preview --save or yarn add surge-preview

All steps are asynchronous and will return a promise. Have a look at steps/ to require github and surge functionality.

Readme

Keywords

Package Sidebar

Install

npm i surge-preview

Weekly Downloads

0

Version

1.0.10

License

ISC

Unpacked Size

6.42 kB

Total Files

6

Last publish

Collaborators

  • alexander-heimbuch