Merge pull request #18 from jellyrock/renovate/globals-17.x #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Docs | |
| on: | |
| push: | |
| branches: [main] | |
| # Triggered by jellyrock/jellyrock when docs/user/** or docs/dev/** changes | |
| repository_dispatch: | |
| types: [docs-update] | |
| workflow_dispatch: | |
| concurrency: | |
| group: deploy-docs | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run checks (astro + eslint + prettier) | |
| run: npm run check | |
| - name: Build user docs | |
| run: npm run build:user | |
| - name: Build dev docs | |
| run: npm run build:dev | |
| - name: Set up SSH | |
| env: | |
| DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} | |
| VPS_KNOWN_HOSTS: ${{ secrets.VPS_KNOWN_HOSTS }} | |
| run: | | |
| mkdir -p ~/.ssh | |
| chmod 700 ~/.ssh | |
| printf '%s\n' "$DEPLOY_SSH_KEY" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| printf '%s\n' "$VPS_KNOWN_HOSTS" > ~/.ssh/known_hosts | |
| chmod 644 ~/.ssh/known_hosts | |
| - name: Deploy user docs to VPS | |
| env: | |
| VPS_HOST: ${{ secrets.VPS_HOST }} | |
| VPS_USER: ${{ secrets.VPS_USER }} | |
| run: | | |
| rsync -avz --delete \ | |
| -e "ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=yes" \ | |
| user-docs/dist/ \ | |
| "${VPS_USER}@${VPS_HOST}:/opt/jellyrock/user-docs/" | |
| - name: Deploy dev docs to VPS | |
| env: | |
| VPS_HOST: ${{ secrets.VPS_HOST }} | |
| VPS_USER: ${{ secrets.VPS_USER }} | |
| run: | | |
| rsync -avz --delete \ | |
| -e "ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=yes" \ | |
| dev-docs/dist/ \ | |
| "${VPS_USER}@${VPS_HOST}:/opt/jellyrock/dev-docs/" | |
| # Deploy heartbeat (ADR-0005). Values passed via env, never inlined into | |
| # the script, to avoid commit-message shell injection. No-op until the | |
| # GOTIFY_URL secret is set. | |
| - name: Notify Gotify on success | |
| if: success() | |
| env: | |
| GOTIFY_URL: ${{ secrets.GOTIFY_URL }} | |
| REPO: ${{ github.event.repository.name }} | |
| COMMIT_MSG: ${{ github.event.head_commit.message }} | |
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| run: | | |
| [ -z "$GOTIFY_URL" ] && { echo "GOTIFY_URL unset — skipping"; exit 0; } | |
| curl -fsS -m 10 "$GOTIFY_URL" \ | |
| -F "priority=3" \ | |
| -F "title=${REPO} deploy ok" \ | |
| -F "message=Commit: ${COMMIT_MSG} | |
| Run: ${RUN_URL}" || true | |
| - name: Notify Gotify on failure | |
| if: failure() | |
| env: | |
| GOTIFY_URL: ${{ secrets.GOTIFY_URL }} | |
| REPO: ${{ github.event.repository.name }} | |
| COMMIT_MSG: ${{ github.event.head_commit.message }} | |
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| run: | | |
| [ -z "$GOTIFY_URL" ] && exit 0 | |
| curl -fsS -m 10 "$GOTIFY_URL" \ | |
| -F "priority=8" \ | |
| -F "title=${REPO} deploy FAILED" \ | |
| -F "message=Commit: ${COMMIT_MSG} | |
| Run: ${RUN_URL}" || true |