Skip to content

eclass/semantic-release-netlify

Repository files navigation

@eclass/semantic-release-netlify

npm build downloads dependencies devDependency Status Coverage Status Maintainability semantic-release

semantic-release plugin to deploy app with netlify

Step Description
verifyConditions Verify the presence of the NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID environment variable.
publish Upload assets to netlify.

Install

npm i -D @eclass/semantic-release-netlify

Usage

The plugin can be configured in the semantic-release configuration file:

{
  "plugins": [
    "@semantic-release/changelog",
    "@semantic-release/npm",
    "@semantic-release/git",
    "@semantic-release/gitlab",
    "@eclass/semantic-release-netlify"
  ]
}

Configuration

Netlify authentication

The netlify authentication configuration is required and can be set via environment variables.

Environment variables

Variable Description
NETLIFY_AUTH_TOKEN Netlify token created via personal access tokens
NETLIFY_SITE_ID Netlify site ID created via netlify sites:create

Examples

{
  "plugins": [
    "@semantic-release/changelog",
    "@semantic-release/npm",
    "@semantic-release/git",
    "@semantic-release/gitlab",
    "@eclass/semantic-release-netlify"
  ]
}
# .gitlab-ci.yml
release:
  image: node:11-alpine
  stage: release
  before_script:
    - npm i -g netlify-cli
  script:
    - npx semantic-release
  only:
    - master
# .travis.yml
language: node_js
cache:
  directories:
    - ~/.npm
node_js:
  - "11"
stages:
  - test
  - name: deploy
    if: branch = master
jobs:
  include:
    - stage: test
      script: npm t
    - stage: deploy
      before_script:
        - npm i -g netlify-cli
      script: npx semantic-release

License

MIT