From c4592c7472dbee1c565dbc95c63e1bb3daa6c88e Mon Sep 17 00:00:00 2001 From: Marc Tonsen Date: Fri, 27 Oct 2023 13:11:22 +0200 Subject: [PATCH] Create build-deploy-staging-vitepress.yml --- .../build-deploy-staging-vitepress.yml | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/build-deploy-staging-vitepress.yml diff --git a/.github/workflows/build-deploy-staging-vitepress.yml b/.github/workflows/build-deploy-staging-vitepress.yml new file mode 100644 index 000000000..569fb1b4e --- /dev/null +++ b/.github/workflows/build-deploy-staging-vitepress.yml @@ -0,0 +1,67 @@ +name: Build/Deploy to Staging (Vitepress) + +on: + workflow_dispatch: # this makes the action manual + +jobs: + build: + name: Install dependencies and generate static site + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Neon dependencies + working-directory: ./neon + run: npm install + - name: Neon build + working-directory: ./neon + run: npm run docs:build + + - name: Neon write commit SHA to gitcommit.txt in dist + shell: bash + run: | + echo $GITHUB_SHA > neon/.vitepress/dist/gitcommit.txt + + - name: Neon get size of files in dist + shell: bash + run: | + du -ah neon/.vitepress/dist + + - name: Archive build artifacts + uses: actions/upload-artifact@v2 + with: + name: neon-vitepress-dist + path: neon/.vitepress/dist + + deploy-staging: + name: Deploy to staging + runs-on: ubuntu-latest + environment: + name: staging + url: https://docs-staging.pupil-labs.com + needs: build + + steps: + - uses: actions/checkout@v3 + + - name: Download generated website dist dir + uses: actions/download-artifact@v2 + with: + name: neon-vitepress-dist + path: neon/.vitepress/dist + + - name: Rsync action - Deploy to staging + uses: burnett01/rsync-deployments@4.1 + with: + switches: -hrvz --delete --exclude=".htaccess" + path: neon/.vitepress/dist/ + remote_path: ${{ secrets.REMOTE_PATH }} + remote_host: ${{ secrets.REMOTE_HOST}} + remote_user: ${{ secrets.REMOTE_USER }} + remote_key: ${{ secrets.DEPLOY_KEY }}