add deployment step #310

Merged
merenber merged 2 commits from merenber-ssh-deploy into main 2021-09-11 15:24:21 -04:00
1 changed files with 19 additions and 1 deletions

View File

@ -46,8 +46,26 @@ steps:
from_secret: STAGING_TOKEN
commands:
- 'curl -XPOST -H "Authorization: $TOKEN" -H "X-Branch: $DRONE_BRANCH" "https://csclub.uwaterloo.ca/~a3thakra/update-csc/"'
Review

Can you add a condition here so it doesn't run on the main branch?

Can you add a condition here so it doesn't run on the main branch?
when:
branch:
exclude:
- main
- name: deploy (production)
image: node:16
depends_on:
- export
environment:
SSH_KEY:
Review

Can we somehow use the /deploy.sh script placed in this repository, just so that everything is in a single place?

Can we somehow use the /deploy.sh script placed in this repository, just so that everything is in a single place?
Review

if not this is also fine :)

if not this is also fine :)
Review

The contents of deploy-website.sh are just

#!/bin/sh
curl -o- https://git.csclub.uwaterloo.ca/www/www-new/raw/branch/main/deploy.sh | bash
The contents of deploy-website.sh are just ```sh #!/bin/sh curl -o- https://git.csclub.uwaterloo.ca/www/www-new/raw/branch/main/deploy.sh | bash ```
Review

if the contents of the file is a single line, why not inline that command here?

if the contents of the file is a single line, why not inline that command here?
Review

It's because we have a command clause in the authorized_keys file for the www user.

It's because we have a `command` clause in the authorized_keys file for the www user.
from_secret: DEPLOYMENT_SSH_KEY
commands:
- 'echo "$SSH_KEY" > /tmp/ssh_key'
- ssh -i /tmp/ssh_key www@caffeine.csclub.uwaterloo.ca '~/bin/deploy-website.sh'
when:
branch:
- main
trigger:
event:
exclude:
- pull_request #avoid double build on PRs
- pull_request #avoid double build on PRs