-
Notifications
You must be signed in to change notification settings - Fork 264
38 lines (33 loc) · 1.1 KB
/
gcp-deploy-staging.yml
File metadata and controls
38 lines (33 loc) · 1.1 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
37
38
name: GCP Deploy (staging)
on:
workflow_run:
workflows: ["Publish to ghcr (staging)"]
types:
- completed
jobs:
deploy:
name: Deploy staging app to GCP
runs-on: ubuntu-latest
steps:
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "${{ secrets.GCP_STAGING_SSH_PRIVATE_KEY }}" > ~/.ssh/private.key
chmod 600 ~/.ssh/private.key
echo "${{ secrets.GCP_STAGING_SSH_KNOWN_HOSTS }}" >> ~/.ssh/known_hosts
- name: Deploy to GCP
run: |
ssh -i ~/.ssh/private.key ${{ secrets.GCP_STAGING_USERNAME }}@${{ secrets.GCP_STAGING_HOST }} << 'EOF'
# Stop and remove any existing container
docker stop -t 60 sourcebot-staging || true
docker rm sourcebot-staging || true
# Run new container
docker run -d \
-p 80:3000 \
--rm \
--pull always \
--env-file .env.staging \
-v /mnt/data:/data \
--name sourcebot-staging \
ghcr.io/sourcebot-dev/sourcebot:staging
EOF