Skip to content

Instantly share code, notes, and snippets.

@thstarshine
Created September 5, 2022 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thstarshine/7f4eec7f4634ba9fa7894ba8fb1a36a2 to your computer and use it in GitHub Desktop.
Save thstarshine/7f4eec7f4634ba9fa7894ba8fb1a36a2 to your computer and use it in GitHub Desktop.
ci test file
image: node:16
cache:
key: "$CI_PROJECT_ID"
paths:
- node_modules/
before_script:
- npm set progress=false
building:
stage: build
variables:
NODE_ENV: "development"
script:
- npm i --no-optional
- npm run build
type: build
tags:
- npm
- node
only:
- tags
- master
testing:
stage: test
variables:
NODE_ENV: "development"
script:
- npm i --no-optional
- npm run test
type: test
tags:
- npm
- node
only:
- tags
- master
staging:
stage: deploy
environment: staging
variables:
NODE_ENV: "production"
script:
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_RUNNER_KEY")
- mkdir -p ~/.ssh
- npm i pm2 -g
- pm2 deploy ecosystem.json staging
type: deploy
tags:
- npm
- node
only:
- master
production:
stage: deploy
environment: production
variables:
NODE_ENV: "production"
script:
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_RUNNER_KEY")
- mkdir -p ~/.ssh
- npm i pm2 -g
- pm2 deploy ecosystem.json production
type: deploy
tags:
- npm
- node
only:
- tags
- trigger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment