Deploy to EC2 #6
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 to EC2 | |
on: workflow_dispatch | |
jobs: | |
deployment: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Deploy to EC2 | |
uses: fifsky/ssh-action@master | |
with: | |
host: ${{ secrets.IP_ADDRESS }} | |
user: ${{ secrets.USER_NAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
command: | | |
cd /var/www | |
cat personal_access_token | docker login ghcr.io -u mhsiungw --password-stdin | |
sudo docker-compose stop && docker-compose rm && docker-compose up --build -d |