@forestvpn/forestvpn_api
Version:
A package to interact api.forestvpn.com (manage vpn profiles, check usage statistics, manage locations, ...)
135 lines (120 loc) • 2.94 kB
YAML
kind: pipeline
type: docker
name: default
trigger:
event:
- push
volumes:
- name: cache
temp: { }
- name: dist
temp: { }
environment:
NPM_CONFIG_CACHE: /cache/npm
steps:
- name: deps
image: node:18.2.0-alpine3.15
volumes:
- name: cache
path: /cache
commands:
- npm install
- name: build
image: node:18.2.0-alpine3.15
volumes:
- name: cache
path: /cache
- name: dist
path: /dist
commands:
- npm install --include=dev
- export PATH=./node_modules/.bin:$PATH
- npm run build
depends_on:
- deps
- name: slack
image: plugins/slack
settings:
webhook:
from_secret: SLACK_WEBHOOK
channel: cicd
link_names: true
template: >
{{#success build.status}}
The {{ repo.owner }}/{{ repo.name }} build <{{ build.link }}| {{build.number}} ↗> is succeeded! Thanks <@{{build.author}}>
{{else}}
The {{ repo.owner }}/{{ repo.name }} build <{{ build.link }}| {{build.number}} ↗> is broken! Blame <@{{build.author}}>
{{/success}}
depends_on:
- build
when:
status: [ success, failure ]
kind: pipeline
type: docker
name: "publish: registry.npmjs.org"
trigger:
event:
- tag
volumes:
- name: cache
temp: { }
- name: dist
temp: { }
environment:
NPM_CONFIG_CACHE: /cache/npm
steps:
- name: deps
image: node:18.2.0-alpine3.15
volumes:
- name: cache
path: /cache
commands:
- npm install
- name: build
image: node:18.2.0-alpine3.15
volumes:
- name: cache
path: /cache
- name: dist
path: /dist
commands:
- npm install --include=dev
- export PATH=./node_modules/.bin:$PATH
- npm run build
depends_on:
- deps
- name: publish
image: node:18.2.0-alpine3.15
environment:
NPM_TOKEN:
from_secret: NPM_TOKEN
volumes:
- name: cache
path: /cache
- name: dist
path: /dist
commands:
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
- npm version --no-git-tag-version $DRONE_TAG
- npm publish --access public --verbose
depends_on:
- build
- name: slack
image: plugins/slack
settings:
webhook:
from_secret: SLACK_RELEASE_WEBHOOK
link_names: true
icon_url: https://unsplash.it/256/256/?random
template: >
{{#success build.status}}
✔ Publish to registry.npmjs.org <{{ build.link }}| {{ repo.owner }}/{{ repo.name }}:{{ build.tag }} ↗> is succeed!! Thanks @{{build.author}}
{{else}}
:x: Publish to registry.npmjs.org <{{ build.link }}| {{ repo.owner }}/{{ repo.name }}:{{ build.tag }} ↗> is failed! Blame @{{build.author}}
{{/success}}
when:
status: [ success, failure ]
depends_on:
- publish