Skip to content

build(deps): bump the php-wasm group across 1 directory with 5 update… #123

build(deps): bump the php-wasm group across 1 directory with 5 update…

build(deps): bump the php-wasm group across 1 directory with 5 update… #123

Workflow file for this run

name: Deploy Pages
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
types: [opened, reopened, synchronize]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
pull-requests: write
concurrency:
group: pages-${{ github.event.pull_request.head.ref || github.ref_name }}
cancel-in-progress: true
env:
CLOUDFLARE_ACCOUNT_ID: 8cdbd0eb9712b3a9a3e9b860fd87ed6c
CLOUDFLARE_PAGES_PROJECT: nextcloud-playground
PREVIEW_BUTTON_IMG: https://raw.githubusercontent.com/ateeducacion/nextcloud-playground/main/assets/playground-preview-button.svg
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/configure-pages@v6
if: github.event_name == 'push'
- uses: actions/setup-node@v7
with:
# Node 24: the tar.zst packer (scripts/build-tar-zst-bundle.mjs) needs
# native node:zlib zstd (>= 22.15) to build the core bundle.
node-version: 24
cache: npm
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
- name: Install dependencies
run: npm install
- name: Prepare runtime assets
run: make prepare
- name: Build Nextcloud bundles (30, 31, 32, 33)
run: make bundle-all
- name: Install docs dependencies
run: python -m pip install -r requirements-docs.txt
- name: Assemble Pages artifact
run: |
mkdir -p _site/docs _site/dist
rsync -a ./ ./_site/ \
--exclude ".git/" \
--exclude ".github/" \
--exclude ".venv/" \
--exclude ".cache/" \
--exclude "_site/" \
--exclude "docs/" \
--exclude "node_modules/" \
--exclude "site/"
mkdocs build --strict --site-dir _site/docs
touch _site/.nojekyll
# Split oversized core bundles (>25 MiB) into parts so the site can be
# served from Cloudflare Pages (25 MiB/file cap). The loader reassembles
# them.
node scripts/chunk-bundles.mjs _site
- name: Upload Pages artifact
if: github.event_name == 'push'
uses: actions/upload-pages-artifact@v5
with:
path: _site
# ── Cloudflare Pages (Direct Upload) ──
- name: Deploy to Cloudflare Pages (production)
if: github.event_name == 'push'
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
run: npx --yes wrangler@4 pages deploy _site --project-name="$CLOUDFLARE_PAGES_PROJECT" --branch=main --commit-dirty=true
- name: Deploy to Cloudflare Pages (PR preview)
id: cf_preview
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
HEAD_REF: ${{ github.head_ref }}
run: |
out=$(npx --yes wrangler@4 pages deploy _site \
--project-name="$CLOUDFLARE_PAGES_PROJECT" \
--branch="$HEAD_REF" --commit-dirty=true 2>&1 | tee /dev/stderr)
proj="$CLOUDFLARE_PAGES_PROJECT"
urls=$(printf '%s\n' "$out" | grep -oE "https://[a-z0-9-]+\.${proj}\.pages\.dev" | sort -u)
deploy_url=$(printf '%s\n' "$urls" | grep -E "https://[0-9a-f]{8}\.${proj}\." | head -n1)
alias_url=$(printf '%s\n' "$urls" | grep -vE "https://[0-9a-f]{8}\.${proj}\." | head -n1)
{ echo "deploy_url=$deploy_url"; echo "alias_url=$alias_url"; } >> "$GITHUB_OUTPUT"
- name: Comment preview URL on PR
if: always() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
HEAD_REF: ${{ github.head_ref }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
DEPLOY_URL: ${{ steps.cf_preview.outputs.deploy_url }}
ALIAS_URL: ${{ steps.cf_preview.outputs.alias_url }}
run: |
MARKER='<!-- cf-preview -->'
LOGO='https://user-images.githubusercontent.com/23264/106598434-9e719e00-654f-11eb-9e59-6167043cfa01.png'
SHA7=$(printf '%s' "$HEAD_SHA" | cut -c1-7)
ALIAS="$ALIAS_URL"
if [ -z "$ALIAS" ]; then
slug=$(printf '%s' "$HEAD_REF" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-+//; s/-+$//' | cut -c1-28 | sed -E 's/-+$//')
ALIAS="https://${slug}.${CLOUDFLARE_PAGES_PROJECT}.pages.dev"
fi
DEPLOY="${DEPLOY_URL:-$ALIAS}"
if [ -n "$DEPLOY_URL" ] || [ -n "$ALIAS_URL" ]; then
BODY=$(printf '%s\n## Deploying %s with &nbsp;<img alt="Cloudflare Pages" src="%s" width="16">&nbsp; Cloudflare Pages\n\n<a href="%s" target="_blank" rel="noopener noreferrer"><img src="%s" alt="Try on the Playground" height="51"></a>\n\n| | |\n| :-- | :-- |\n| **Latest commit** | `%s` |\n| **Preview URL (branch)** | %s |\n| **Deployment URL (commit)** | %s |' \
"$MARKER" "$CLOUDFLARE_PAGES_PROJECT" "$LOGO" "$ALIAS" "$PREVIEW_BUTTON_IMG" "$SHA7" "$ALIAS" "$DEPLOY")
else
BODY=$(printf '%s\n## Deploying %s with Cloudflare Pages\n\n⚠️ Preview deploy failed — see the workflow logs.\n\nBranch `%s`' \
"$MARKER" "$CLOUDFLARE_PAGES_PROJECT" "$HEAD_REF")
fi
CID=$(gh api "repos/$REPO/issues/$PR_NUMBER/comments" \
--jq "map(select(.body|startswith(\"$MARKER\")))|.[0].id // empty")
if [ -n "$CID" ]; then
gh api -X PATCH "repos/$REPO/issues/comments/$CID" -f body="$BODY" >/dev/null
else
gh api -X POST "repos/$REPO/issues/$PR_NUMBER/comments" -f body="$BODY" >/dev/null
fi
deploy:
if: github.event_name == 'push'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- id: deployment
uses: actions/deploy-pages@v5