From 059ca197e506a6fede12bc6e632b79cf7c085258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Manzanero=20Dom=C3=ADnguez?= Date: Mon, 8 Jul 2024 19:07:36 -0600 Subject: [PATCH] add github actions for deploying to vps --- .github/workflows/cd.yml | 23 +++++++++++++++++++++++ .github/workflows/ci.yml | 19 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/cd.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..bf05c0a --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,23 @@ +name: CD + +on: + push: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Deploy using ssh + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.PRIVATE_KEY }} + port: ${{ secrets.PORT }} + script: | + cd ~/apps/website + git pull origin main + pnpm run install + pnpm run build + cp -r ./dist/* /var/www/website diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..acc388d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: CI + +on: + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Build project + uses: actions/setup-node@v2 + with: + node-version: 20.x + - run: pnpm install + - run: pnpm run build