From 8196020a242072bdd9e1e4a21c013df45397b62a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leandro=20Ant=C3=B4nio=20Farias=20Machado?= <83298718+leandrofars@users.noreply.github.com> Date: Mon, 15 May 2023 10:39:43 -0300 Subject: [PATCH] feat(devops): automatic deploy front-end [v1] --- .github/github-actions-ec2.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/github-actions-ec2.yml 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 + +