Skip to content

Commit

Permalink
fixing deploy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
smltr committed Aug 18, 2024
1 parent 89de47e commit a8a8201
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 23 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
name: Deploy to Google Cloud
name: Deploy to Google Cloud

on:
push:
branches:
- main # Trigger deployment on push to main branch
on:
push:
branches:
- main # Trigger deployment on push to main branch

jobs:
deploy:
runs-on: ubuntu-latest
jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Google Cloud SDK
uses: google-github-actions/[email protected]
with:
version: 'latest'
project_id: ${{ secrets.PROJECT_ID }}
service_account_key: ${{ secrets.GOOGLE_CREDENTIALS }}
- name: Set up Google Cloud SDK
uses: google-github-actions/[email protected]
with:
version: 'latest'
project_id: ${{ secrets.PROJECT_ID }}
service_account_key: ${{ secrets.GOOGLE_CREDENTIALS }}

- name: Deploy to Google Compute Engine
run: |
gcloud compute ssh ${{ secrets.INSTANCE_NAME }} \
--project ${{ secrets.PROJECT_ID }} \
--zone ${{ secrets.ZONE }} \
--command "cd /home/trouys16/Jobby && git pull origin main && pnpm i && pnpm run start"
- name: Deploy to Google Compute Engine
run: |
gcloud compute ssh your-username@${{ secrets.INSTANCE_NAME }} \
--project ${{ secrets.PROJECT_ID }} \
--zone ${{ secrets.ZONE }} \
--command "cd /home/trouys16/Jobby && ./deploy.sh"
20 changes: 20 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Navigate to your application directory
cd /home/trouys16/Jobby

# Pull the latest code
git pull origin main

# Install dependencies
pnpm i

# Kill processes running on port 3000 (API) and 5173 (web app)
fuser -k 3000/tcp || true
fuser -k 5173/tcp || true

# Optionally wait a few seconds to ensure processes are killed
sleep 5

# Start the application
pnpm run start

0 comments on commit a8a8201

Please sign in to comment.