-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Github Workflow for continuous deployment (#93)
* add github workflow for continuous deployment * fix distribution path
- Loading branch information
Showing
2 changed files
with
37 additions
and
3 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 |
---|---|---|
@@ -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 | ||
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,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; |