MC/.forgejo/workflows/web-deploy.yml
Dev 6deb4a2e7d DuneRealms V2 clean baseline
Owner-authorised history reset; current source tree preserved exactly.
2026-11-13 00:05:14 +01:00

59 lines
1.8 KiB
YAML

name: DuneRealms Web CI
on:
push:
branches:
- main
paths:
- 'website/**'
- '.forgejo/workflows/web-deploy.yml'
workflow_dispatch:
jobs:
web:
runs-on: dune-ci
steps:
- name: Checkout
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git init .
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/MC.git "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
- name: Install Node 22
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Verify deployment policy
run: node --test .forgejo/tests/web-deploy.test.mjs
- name: Build and test website
working-directory: website
run: |
corepack enable
corepack pnpm install --frozen-lockfile
corepack pnpm build
corepack pnpm test
- name: Upload website build
uses: actions/upload-artifact@v3
with:
name: DuneRealms-Website
path: website/dist/
if-no-files-found: error
- name: Trigger deployment after successful CI
if: github.ref == 'refs/heads/main'
shell: bash
env:
DEPLOY_KEY: ${{ secrets.DUNEREALMS_DEPLOY_KEY }}
run: |
install -m 700 -d ~/.ssh
printf '%s\n' "$DEPLOY_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
printf '%s\n' '162.55.87.104 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILy1N6Eo+BMRgstSpYc90ZHDQtm+8iTYiNMTI3XMVi5h root@Debian-bookworm-latest-amd64-base' >> ~/.ssh/known_hosts
ssh -p 22 -i ~/.ssh/deploy_key -o IdentitiesOnly=yes -o BatchMode=yes dunedeploy@162.55.87.104 "$GITHUB_SHA"
rm -f ~/.ssh/deploy_key