2021-06-29 15:08:05 -04:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
2021-08-08 18:14:09 -04:00
|
|
|
name: node16
|
2021-06-29 15:08:05 -04:00
|
|
|
|
|
|
|
steps:
|
2021-09-27 16:20:18 -04:00
|
|
|
- name: install-deps
|
2021-08-24 14:42:57 -04:00
|
|
|
image: node:16
|
|
|
|
commands:
|
2021-09-27 16:20:18 -04:00
|
|
|
- npm install
|
2021-08-24 14:42:57 -04:00
|
|
|
|
2021-09-27 16:20:18 -04:00
|
|
|
- name: check-lockfile
|
2021-08-08 18:14:09 -04:00
|
|
|
image: node:16
|
2021-08-24 14:42:57 -04:00
|
|
|
depends_on:
|
2021-09-27 16:20:18 -04:00
|
|
|
- install-deps
|
2021-06-29 15:08:05 -04:00
|
|
|
commands:
|
2021-09-27 16:20:18 -04:00
|
|
|
- npm run check-lockfile
|
2021-06-29 15:08:05 -04:00
|
|
|
|
|
|
|
- name: lint
|
2021-08-08 18:14:09 -04:00
|
|
|
image: node:16
|
2021-06-29 15:08:05 -04:00
|
|
|
depends_on:
|
|
|
|
- install-deps
|
|
|
|
commands:
|
|
|
|
- npm run lint
|
|
|
|
|
2021-10-31 16:58:14 -04:00
|
|
|
- name: optimize-images
|
2021-08-08 18:14:09 -04:00
|
|
|
image: node:16
|
2021-06-29 15:08:05 -04:00
|
|
|
depends_on:
|
|
|
|
- install-deps
|
|
|
|
commands:
|
2021-10-31 16:58:14 -04:00
|
|
|
- npm run build:images
|
2021-09-27 16:20:18 -04:00
|
|
|
|
|
|
|
- name: generate-calendar
|
|
|
|
image: node:16
|
|
|
|
depends_on:
|
|
|
|
- install-deps
|
|
|
|
commands:
|
2021-10-31 16:58:14 -04:00
|
|
|
- npm run build:calendar
|
|
|
|
|
2022-08-07 19:35:56 -04:00
|
|
|
- name: generate-api
|
|
|
|
image: node:16
|
|
|
|
depends_on:
|
|
|
|
- install-deps
|
|
|
|
commands:
|
|
|
|
- npm run build:api
|
|
|
|
|
2021-10-31 16:58:14 -04:00
|
|
|
- name: build
|
|
|
|
image: node:16
|
|
|
|
depends_on:
|
|
|
|
- optimize-images
|
|
|
|
commands:
|
2021-11-22 12:47:00 -05:00
|
|
|
- USE_LDAP=true npm run build:web
|
2021-06-29 15:08:05 -04:00
|
|
|
|
|
|
|
- name: export
|
2021-08-08 18:14:09 -04:00
|
|
|
image: node:16
|
2021-06-29 15:08:05 -04:00
|
|
|
depends_on:
|
2022-08-07 19:35:56 -04:00
|
|
|
- generate-api
|
2021-09-27 16:20:18 -04:00
|
|
|
- generate-calendar
|
2021-10-31 16:58:14 -04:00
|
|
|
- build
|
2021-06-29 15:08:05 -04:00
|
|
|
commands:
|
|
|
|
- npm run export
|
|
|
|
|
2021-08-23 13:50:43 -04:00
|
|
|
- name: deploy (staging)
|
|
|
|
image: node:16
|
|
|
|
depends_on:
|
|
|
|
- export
|
|
|
|
environment:
|
|
|
|
TOKEN:
|
|
|
|
from_secret: STAGING_TOKEN
|
|
|
|
commands:
|
2021-08-25 00:24:53 -04:00
|
|
|
- 'curl -XPOST -H "Authorization: $TOKEN" -H "X-Branch: $DRONE_BRANCH" "https://csclub.uwaterloo.ca/~a3thakra/update-csc/"'
|
2021-09-11 15:24:19 -04:00
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
exclude:
|
|
|
|
- main
|
|
|
|
|
|
|
|
- name: deploy (production)
|
|
|
|
image: node:16
|
|
|
|
depends_on:
|
|
|
|
- export
|
|
|
|
environment:
|
|
|
|
SSH_KEY:
|
|
|
|
from_secret: DEPLOYMENT_SSH_KEY
|
|
|
|
commands:
|
|
|
|
- 'echo "$SSH_KEY" > /tmp/ssh_key'
|
2021-09-11 15:59:11 -04:00
|
|
|
- chmod 600 /tmp/ssh_key
|
2021-09-11 16:21:49 -04:00
|
|
|
- ssh -4 -i /tmp/ssh_key www@caffeine.csclub.uwaterloo.ca -o StrictHostKeyChecking=no '~/bin/deploy-website.sh'
|
2021-09-11 15:24:19 -04:00
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- main
|
2021-08-23 13:50:43 -04:00
|
|
|
|
2021-06-29 15:08:05 -04:00
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
exclude:
|
2021-09-11 15:24:19 -04:00
|
|
|
- pull_request #avoid double build on PRs
|