Skip to content

Glasgow 6 | Haroun Alarabi | Full-Stack-Project-Assessment | Level 300 #9

Glasgow 6 | Haroun Alarabi | Full-Stack-Project-Assessment | Level 300

Glasgow 6 | Haroun Alarabi | Full-Stack-Project-Assessment | Level 300 #9

name: Push-to-EC2
on:
push:
branches:
- Level--300
jobs:
deploy:
name: Deploy to EC2 on master branch push
runs-on: ubuntu-latest
steps:
- name: Checkout the files
uses: actions/checkout@v2
- name: Deploy to Server 1
# uses: easingthemes/ssh-deploy@Level--300
env:
SSH_PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY }}
REMOTE_HOST: ${{ secrets.HOST_DNS }}
REMOTE_USER: ${{ secrets.USERNAME }}
# TARGET: ${{ secrets.TARGET_DIR }}
- name: Executing remote ssh commands using ssh key
# uses: appleboy/ssh-action@Level--300
with:
host: ${{ secrets.HOST_DNS }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
sudo apt-get -y update
sudo apt-get install -y apache2
sudo systemctl start apache2
sudo systemctl enable apache2
cd server
sudo mv * /var/www/html