From 0396cc114219ac6f4441ea8e209eba2b4777b914 Mon Sep 17 00:00:00 2001 From: Ashar Fuadi Date: Sun, 18 Aug 2024 13:29:13 +0700 Subject: [PATCH] Add CI --- .github/workflows/ci.yml | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..31090fb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: ci + +on: + push: + branches: + - "*" + pull_request: + branches: + - main + +jobs: + deploy-web: + if: github.ref == 'refs/heads/main' && github.repository_owner == 'ia-toki' + runs-on: ubuntu-22.04 + env: + HOST: ${{ secrets.HOST }} + KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 50 + + - name: Set up node + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Build + run: | + yarn install + yarn build + + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.PRIVATE_KEY }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} + + - name: Rsync + run: rsync -avzh build/ root@${HOST}:/var/www/html/panduan --delete