cs-2022-class-profile/.drone.yml

85 lines
1.7 KiB
YAML

---
kind: pipeline
type: docker
name: node16
steps:
- name: view-staging-url
image: node:16
commands:
- echo "staging url will be https://${DRONE_BRANCH//\//-}-csc-class-profile-staging-snedadah.k8s.csclub.cloud"
- name: install-deps
image: node:16
commands:
- npm install
- name: lint
image: node:16
depends_on:
- install-deps
commands:
- npm run lint
- name: build
image: node:16
depends_on:
- install-deps
commands:
- npm run build
- name: export
image: node:16
depends_on:
- build
commands:
- npm run export
- name: publish
image: plugins/docker:latest
depends_on:
- export
settings:
username:
from_secret: HARBOUR_USERNAME
password:
from_secret: HARBOUR_PASSWORD
tags:
- ${DRONE_BRANCH//\//-}
- latest
registry: registry.cloud.csclub.uwaterloo.ca
repo: registry.cloud.csclub.uwaterloo.ca/snedadah/csc-class-profile-staging
- name: deploy-staging
image: node:16
depends_on:
- publish
environment:
STAGING_AUTH_TOKEN:
from_secret: STAGING_AUTH_TOKEN
commands:
- echo "The docker build tag is ${DRONE_BRANCH//\//-}"
- 'curl -H "Authorization: $STAGING_AUTH_TOKEN" https://csclub.uwaterloo.ca/~snedadah/webhooks/cscclassprofilestaging?ref=${DRONE_BRANCH//\//-}'
- name: deploy-production
image: node:16
depends_on:
- export
environment:
SSH_KEY:
from_secret: DEPLOYMENT_SSH_KEY
commands:
- 'echo "$SSH_KEY" > /tmp/ssh_key'
- chmod 600 /tmp/ssh_key
- ssh -4 -i /tmp/ssh_key www@caffeine.csclub.uwaterloo.ca -o StrictHostKeyChecking=no '~/bin/classprofile/deploy-2022.sh'
when:
branch:
- main
trigger:
event:
exclude:
- pull_request #avoid double build on PRs