Allow build-only website CI from the development repository

This commit is contained in:
unimatrixgit 2026-11-28 10:35:34 +01:00
commit 220dd1b1dc

View file

@ -7,20 +7,24 @@ on:
paths:
- 'website/**'
- '.forgejo/workflows/web-deploy.yml'
- '.forgejo/tests/web-deploy.test.mjs'
workflow_dispatch:
jobs:
web:
if: github.repository == 'unimatrix/MC' || (github.repository == 'dev/MC' && github.event_name == 'workflow_dispatch')
runs-on: dune-ci
steps:
- name: Checkout
- name: Check out exact revision
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
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 -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 "https://www.dunerealms.com/git/${GITHUB_REPOSITORY}.git" "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
- name: Install Node 22
uses: actions/setup-node@v4
@ -28,6 +32,7 @@ jobs:
node-version: '22'
- name: Prepare publication comparison
if: github.repository == 'unimatrix/MC' && github.ref == 'refs/heads/main'
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -56,7 +61,7 @@ jobs:
node --test --test-concurrency=1 ../tools/tests/*.test.mjs
- name: Upload website build
if: github.ref == 'refs/heads/main'
if: github.repository == 'unimatrix/MC' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: DuneRealms-Website
@ -65,7 +70,7 @@ jobs:
retention-days: 1
- name: Trigger deployment after successful CI
if: github.ref == 'refs/heads/main'
if: github.repository == 'unimatrix/MC' && github.ref == 'refs/heads/main'
shell: bash
env:
DEPLOY_KEY: ${{ secrets.DUNEREALMS_DEPLOY_KEY }}