-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
43 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |