Skip to content

Merge pull request #346 from phalcon/cloudflare-routes #834

Merge pull request #346 from phalcon/cloudflare-routes

Merge pull request #346 from phalcon/cloudflare-routes #834

name: Deploy Documents
on:
push:
branches:
- master
workflow_dispatch:
env:
# The branch that Cloudflare Pages serves. `production` during the trial
# of the new site; `gh-pages` holds the last MkDocs deployment as the
# rollback. Flip the Pages production branch together with this value.
DEPLOY_BRANCH: production
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: true
- name: Set up pnpm
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
- name: Set up Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Update the new feature request list
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm run update-nfr
- name: Test
run: pnpm test
- name: Get the fan art
# The HTML comment at the top of every page. The committed
# src/fanart.html is the fallback when the download fails.
run: |
curl -fsSL -o src/fanart.html \
https://raw.githubusercontent.com/phalcon/assets/master/phalcon/fanart-fragment.html \
|| echo "Download failed, the committed fan art is used"
- name: Get the sponsors
# Generated into phalcon/assets by its own scheduled workflow. The
# committed src/sponsors.json is the fallback when the download fails.
run: |
curl -fsSL -o src/sponsors.json \
https://raw.githubusercontent.com/phalcon/assets/master/phalcon/sponsors.json \
|| echo "Download failed, the committed roster is used"
- name: Build
run: pnpm build
- name: Publish to the deploy branch
# dist/_redirects (written by the cloudflare-redirects hook in
# astro.config.ts) carries /latest -> the stable version, so the
# deployment is self-contained: no zone rule to update from here.
run: |
git config user.name niden
git config user.email nikos@niden.net
git fetch --no-tags --prune --depth=1 origin "+refs/heads/${DEPLOY_BRANCH}:refs/remotes/origin/${DEPLOY_BRANCH}"
git worktree add ../deploy "origin/${DEPLOY_BRANCH}"
rsync -a --delete --exclude .git dist/ ../deploy/
touch ../deploy/.nojekyll
git -C ../deploy add -A
git -C ../deploy commit -m "Deployed ${GITHUB_SHA::7}" || echo "No changes to deploy"
git -C ../deploy push origin "HEAD:${DEPLOY_BRANCH}"