Skip to content

Update GitHub Action to deploy latest main branch. #19

Update GitHub Action to deploy latest main branch.

Update GitHub Action to deploy latest main branch. #19

Workflow file for this run

name: Deploy to EC2
on:
push:
branches:
- main
jobs:
start:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: AWS SSM Send-Command
uses: peterkimzz/aws-ssm-send-command@master
id: ssm
with:
aws-region: ${{ secrets.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
instance-ids: ${{ secrets.INSTANCE_ID }}
working-directory: /home/ec2-user
command: |
sudo mkdir -p /opt/albertclo.com
cd /opt/albertclo.com
if [ ! -d .git ]; then
sudo git clone https://github.com/AlbertClo/albertclo.com .
else
sudo git fetch origin
fi
sudo git checkout main
sudo git pull -f