-
Notifications
You must be signed in to change notification settings - Fork 1
36 lines (31 loc) · 1.2 KB
/
deploy.yml
File metadata and controls
36 lines (31 loc) · 1.2 KB
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
name: Deploy to GCP VM
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Authenticate to GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
- name: Install gcloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ethereal-effort-397820
- name: Set up SSH keys
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GCP_SSH_PRIVATE_KEY }}" > ~/.ssh/google_compute_engine
echo "${{ secrets.GCP_SSH_PUBLIC_KEY }}" > ~/.ssh/google_compute_engine.pub
chmod 600 ~/.ssh/google_compute_engine
chmod 644 ~/.ssh/google_compute_engine.pub
- name: Deploy to VM
run: |
gcloud compute ssh tjctgrader@autograder2 \
--zone us-east4-b \
--command "cd /home/tjctgrader/autograder && git fetch origin && git reset --hard origin/main && /home/tjctgrader/.local/bin/uv sync && /home/tjctgrader/.local/bin/uv run manage.py migrate && sudo systemctl restart celery-coderunner celery daphne nginx"