jevstrudel.git / .forgejo / workflows / deploy-hot.yml
1name: Build and Deploy hot PRs
2
3on:
4  pull_request_target:
5    types: [labeled]

Allow one concurrent deployment

8concurrency:
9  group: "warm-pages"
10  cancel-in-progress: false
12jobs:
13  build:
14    if: ${{ github.event.label.name == 'serve-hot' }}
15    runs-on: docker
16    steps:
17      - uses: actions/checkout@v4
18        with:
19          ref: ${{ github.event.pull_request.head.sha }}      
20      - uses: pnpm/action-setup@v4
21        with:
22          version: 9.12.2
23      - uses: actions/setup-node@v4
24        with:
25          node-version: 20
26
27      - name: Install Dependencies
28        run: pnpm install
29
30      - name: Build
31        run: pnpm build
32
33      - name: Deploy
34        env:
35          SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
36        run: |
37          eval $(ssh-agent -s)
38          echo "$SSH_PRIVATE_KEY" | ssh-add -
39          apt update && apt install -y rsync
40          mkdir -p ~/.ssh
41          ssh-keyscan matrix.toplap.org > ~/.ssh/known_hosts
42          rsync -atv --delete --delete-after --progress \
43            ./website/dist/ \
44            strudel@matrix.toplap.org:/home/strudel/deploy/pr-${{ github.event.pull_request.number }}.hot.strudel.cc