forked from screwdriver-cd-test/quickstart-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
screwdriver.yaml
59 lines (58 loc) · 3.1 KB
/
screwdriver.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
# Shared definition block
# This is where you would define any attributes that all your jobs will
# inherit.
shared:
# We specify a common NodeJS Docker image for our Jobs. It takes the form of
# "repo_name:tag_label", where the "tag_label" is optional.
# Docker image - https://hub.docker.com/r/library/node/
image: node:6
# Jobs definition block
# All pipelines have "main" by default, and is implicitly defined.
jobs:
# We explicitly define "main" in our configuration so that it does what we want
# it to do.
main:
# Requires is a single job name or array of job names that will trigger the job to run.
# Jobs defined with "requires: ~pr" are started by pull-request events.
# Jobs defined with "requires: ~commit" are started by push events.
# Jobs defined with "requires: ~sd@123:main" are started by job "main" from pipeline "123".
# Jobs defined with "requires: main" are started after "main" is done.
# Jobs defined with "requires: [deploy-west, deploy-east] are started after "deploy-west" and "deploy-east" are both done running successfully.
requires: [~pr, ~commit]
# Steps is the ordered list of commands to execute.
# Each step takes the form "step_name: command_to_run". The "step_name" is a
# convenient label to reference it by. The "command_to_run" is the single
# command that is executed during the step.
steps:
# Our "install" step is first in the list. It installs your NodeJS dependencies
# NPM reference document - https://docs.npmjs.com/cli/install
- install: npm install
# The next step is "test". It tests your NodeJS package
# NPM reference document - https://docs.npmjs.com/cli/test
- test: npm test
# We define another Job called "publish". In this stage of the pipeline, we intend
# on publishing our package to the NPM Registry.
publish:
requires: main
steps:
# "set_access" is the first step that is executed. We want the community to use
# our package, so we enable publicly accessible
# NPM reference document - https://docs.npmjs.com/cli/access
- set_access: npm config set access public > /dev/null 2>&1
# "set_token" sets our NPM auth token in the NPM config. This is how the build
# will authenticate with the NPM Registry.
# Blog article reference - http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules
- set_token: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN > /dev/null 2>&1
# In "publish_npm", we perform the actual publishing
# NPM reference document - https://docs.npmjs.com/cli/publish
- publish_npm: npm publish
# Allowed secrets block.
# This list of secrets that are explicitly allowed to be exposed during the
# "publish" Job.
# Screwdriver document reference - http://docs.screwdriver.cd/user-guide/configuration/secrets/
secrets:
# We require our NPM Token to be available so that we can publish our package
# to the NPM Registry. Our secret is stored as "NPM_TOKEN", and is accessible
# in the build as an environment variable with the same name
- NPM_TOKEN