Skip to content

Commit

Permalink
Add Github Workflow for continuous deployment (#93)
Browse files Browse the repository at this point in the history
* add github workflow for continuous deployment

* fix distribution path
  • Loading branch information
theoden42 authored Oct 19, 2024
1 parent e29ba49 commit 95aa2bf
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy Frontend

on:
push:
branches:
- main

jobs:
deploy:
runs-on: Ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Install SSH Agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY_VCM }}

- name: Copy new changes
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.VCM_HOST_USERNAME }}@${{ secrets.VCM_HOST_DNS }} 'rm -rf ${{ VCM_FRONTEND_DIR }}'
scp -o StrictHostKeyChecking=no -r ./* ${{ secrets.VCM_HOST_USERNAME}}@${{ secrets.VCM_HOST_DNS }}:${{VCM_FROTEND_DIR}}
- name: Build the changes and deploy
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.VCM_HOST_USERNAME }}@${{ secrets.VCM_HOST_DNS }} << EOF
sudo cd ${{ VCM_FRONTEND_DIR }}
sudo npm install
sudo npm run build
sudo rm -rf /var/www
sudo cp -r dist/* /var/www/
sudo systemctl restart nginx
EOF
4 changes: 1 addition & 3 deletions src/utils/envConfig.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const config = {
apiUrl: import.meta.env.PROD
? "https://vcm-backend-production.up.railway.app"
: "http://127.0.0.1:8000",
apiUrl: import.meta.env.VITE_API_URL || "http://127.0.0.1:8000"
};

export default config;

0 comments on commit 95aa2bf

Please sign in to comment.