Skip to content

Commit

Permalink
Fix deploy script (#29)
Browse files Browse the repository at this point in the history
* Fix workflow trigger
  • Loading branch information
jloh02 authored Feb 22, 2024
1 parent 6ea139e commit aa81852
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Deploy to Beta

on:
pull_request:
push:
branches: ["master"]
types: ["opened"]
paths:
- frontend/**
- backend/**
workflow_dispatch:

jobs:
Expand All @@ -28,23 +28,23 @@ jobs:
git stash
# Pull from git repo
git checkout ${{ github.event.pull_request.head.sha || 'master' }} || true # Force return true so exit code is not 1
git checkout master || true # Force return true so exit code is not 1
git pull
# Clear space
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker image prune -f
# Build frontend
cd frontend
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S bash ./build-prod.sh
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S bash ./build.sh
cd ..
# Build backend
cd backend
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker build -t jermytan/treeckle-backe
nd:production .
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker build -t jermytan/treeckle-backend:latest .
cd ..
# Deploy
cd ..
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker-compose -f ./docker-compose.prod.yml up -d frontend-staging
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker-compose -f ./docker-compose.prod.yml up -d backend-staging
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,18 @@ jobs:
# Clear space
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker image prune -f
# Build
# Build frontend
cd frontend
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S bash ./build-prod.sh
cd ..
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker-compose -f ./docker-compose.prod.yml up -d
# Build backend
cd backend
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker build -t jermytan/treeckle-backend:production .
cd ..
# Deploy
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker-compose -f ./docker-compose.prod.yml up -d
# Restore changes
git stash pop || true # Force return true in case no changes stashed

0 comments on commit aa81852

Please sign in to comment.