adding folder to organize deployment and adding new github action #4
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
on: | |
push: | |
branches: | |
- main | |
paths: | |
- nginx.conf | |
name: update nginx | |
jobs: | |
update-nginx: | |
name: Update & Restart Nginx | |
runs-on: ubuntu-latest | |
steps: | |
- name: Execute pull scripts on EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.AWS_HOST }} | |
username: ${{ secrets.AWS_USERNAME }} | |
key: ${{ secrets.AWS_KEY }} | |
script: | | |
cd /home/ec2-user/byte-server | |
git add . | |
git stash | |
git checkout main | |
git pull | |
sudo cp nginx.conf /etc/nginx/nginx.conf | |
sudo nginx -s reload |