name: Seeds Web UI on: push: branches: - "main" paths: - "typescript/seeds-webui/**" - "typescript/common/**" - "db/seeds/**" - ".github/workflows/seeds-webui.yml" pull_request: branches: - "main" paths: - "typescript/seeds-webui/**" - "typescript/common/**" - "db/seeds/**" - ".github/workflows/seeds-webui.yml" workflow_dispatch: permissions: contents: read jobs: build: runs-on: ubuntu-latest container: image: ghcr.io/zkldi/tachi-ci:main options: --user root steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Install dependencies run: bun install --frozen-lockfile - name: Lint run: bun run --filter tachi-seeds-webui lint - name: Typecheck run: bun run --filter tachi-seeds-webui typecheck - name: Production build run: bun run --filter tachi-seeds-webui build env: VITE_SEEDS_REPO: zkldi/Tachi BUILD_OUT_DIR: /tmp/seeds-webui - name: Bundle build output if: github.ref == 'refs/heads/main' && github.event_name == 'push' run: tar -C /tmp -czf seeds-webui.tgz seeds-webui - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 if: github.ref == 'refs/heads/main' && github.event_name == 'push' with: name: seeds-webui path: seeds-webui.tgz retention-days: 1 deploy: runs-on: ubuntu-latest needs: build if: github.ref == 'refs/heads/main' && github.event_name == 'push' steps: - name: Install rsync run: sudo apt-get update && sudo apt-get install -y rsync - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: seeds-webui - name: Unpack build output run: tar -C /tmp -xzf seeds-webui.tgz - name: Enable SSH env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }} run: | mkdir -p ~/.ssh printf '%s' "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa printf '%s' "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - name: Deploy static to seeds.tachi.ac root env: TACHI_HOST: ${{ secrets.TACHI_HOST }} run: rsync --recursive --compress --delete --progress /tmp/seeds-webui/. "ci@${TACHI_HOST}:/srv/tachi-static/seeds/"