generated from CS3219-AY2324S1/course-assessment-template
-
Notifications
You must be signed in to change notification settings - Fork 4
41 lines (35 loc) · 1.34 KB
/
deployment.yml
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
name: Deployment Workflow
on:
workflow_dispatch:
workflow_run:
workflows: ["Selectively Build and Push to Artifact Registry", "Build and Push to Artifact Registry"]
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
if: >
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.outputs.build_status == 'true')
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: "Set up google auth"
id: auth
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.SERVICE_ACCOUNT_KEY }}"
- name: "Use gcloud CLI"
run: "gcloud info"
- name: "SSH to VM"
id: 'compute-ssh'
uses: 'google-github-actions/ssh-compute@v0'
with:
instance_name: 'peerprep-prod'
zone: 'asia-southeast1-b'
ssh_private_key: '${{ secrets.SSH_KEY }}'
command: 'echo "${{ secrets.ENV_FILE }}" | sudo tee /usr/src/peerprep/.env > /dev/null && sudo chmod 777 /usr/src/peerprep/scripts/init.sh && sudo /usr/src/peerprep/scripts/init.sh'
- id: 'test'
run: |-
echo '${{ steps.compute-ssh.outputs.stdout }}'
echo '${{ steps.compute-ssh.outputs.stderr }}'