diff --git a/.github/github-actions-ec2.yml b/.github/github-actions-ec2.yml new file mode 100644 index 0000000..439c1ab --- /dev/null +++ b/.github/github-actions-ec2.yml @@ -0,0 +1,31 @@ +name: Deploy Project + +# Trigger deployment only on push to master branch +on: + push: + branches: + - main + +jobs: + deploy: + name: Deploy Front-End + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Deploy to EC2 instance + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST_DNS }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.EC2_SSH_KEY }} + script: | + cd ~/oktopus/frontend + git pull origin master + yarn install && + yarn build && + pm2 restart oktopus + +