From 0ca54cc5ecb4bb37f17e18d1f5627661c90757a4 Mon Sep 17 00:00:00 2001 From: nfesta2023 <142601504+nfesta2023@users.noreply.github.com> Date: Sun, 21 Jan 2024 22:33:26 +0700 Subject: [PATCH] apply cicd (#40) Co-authored-by: NHT --- .github/workflows/CICDwithEC2.yml | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/CICDwithEC2.yml diff --git a/.github/workflows/CICDwithEC2.yml b/.github/workflows/CICDwithEC2.yml new file mode 100644 index 0000000..2a3c9d5 --- /dev/null +++ b/.github/workflows/CICDwithEC2.yml @@ -0,0 +1,37 @@ +name: CICD with EC2 + +on: + push: + branches: [main] + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-22.04 + + if: github.ref == 'refs/heads/main' + + strategy: + matrix: + node-version: [20.x] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + + - run: yarn install --immutable + - run: yarn build + + - name: rsync deployments + uses: burnett01/rsync-deployments@6.0.0 + with: + switches: -avzr --delete --exclude=".env" + path: ./* + remote_path: /var/www/restaurant-service + remote_host: 52.76.71.215 + remote_user: ubuntu + remote_key: '${{ secrets.SSH_PRIVATE_KEY }}'