Remove sudo assertive from cd commands in workflow (#99) #8
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
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: Pull New Changes | |
run: | | |
ssh -o StrictHostKeyChecking=no ${{ secrets.VCM_HOST_USERNAME }}@${{ secrets.VCM_HOST_DNS }} << EOF | |
cd ${{ secrets.VCM_FRONTEND_DIR }} | |
sudo git pull origin main | |
EOF | |
- name: Build the changes and deploy | |
run: | | |
ssh -o StrictHostKeyChecking=no ${{ secrets.VCM_HOST_USERNAME }}@${{ secrets.VCM_HOST_DNS }} << EOF | |
cd ${{ secrets.VCM_FRONTEND_DIR }} | |
sudo npm install --legacy-peer-deps | |
sudo npm run build | |
sudo rm -rf /var/www/* | |
sudo cp -r dist/* /var/www/ | |
sudo systemctl restart nginx | |
EOF | |