Skip to content

additional corrections #844

additional corrections

additional corrections #844

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: Get the design tools
# src/lib/design-checks.mjs and src/lib/design-refresh.mjs are copies of
# phalcon/tools/ in phalcon/assets: the checks and the refresh of the
# design files, the same on every Phalcon site. A download that fails,
# or a file that is not valid JavaScript, keeps the committed copy. The
# design files and the tests that come next use the new tools.
run: |
for file in design-checks.mjs design-refresh.mjs; do
new="src/lib/${file%.mjs}.new.mjs"
if curl -fsSL --max-time 30 -o "$new" "https://assets.phalcon.io/phalcon/tools/$file" && node --check "$new"; then
mv "$new" "src/lib/$file"
else
rm -f "$new"
echo "::warning title=Design tools::$file: the committed copy is used"
fi
done
- name: Get the design tokens
# src/styles/tokens.css and src/styles/code-theme.json are copies of
# phalcon/css/tokens.css and phalcon/css/code-theme.json in
# phalcon/assets. The script keeps a committed copy, with a warning,
# when its download fails or the file is not correct (for example, a
# token that the docs use is missing). It does not commit. It runs
# before the tests, so that they check the files that the build uses.
run: node scripts/update-tokens.mjs
- 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 EMPTY on purpose: a failed download then renders
# nothing, so the art's presence in the page source is itself proof
# that this step ran. A committed copy would make a working download
# and a silent fallback indistinguishable.
run: |
curl -fsSL -o src/fanart.html \
https://assets.phalcon.io/phalcon/fanart-fragment.html \
|| echo "Download failed, no fan art is rendered"
- name: Get the sponsors
# Generated into phalcon/assets by its own scheduled workflow. The
# committed src/sponsors.json holds an EMPTY roster on purpose: a
# failed download then renders no sponsors at all, which is visible and
# can be alerted on, rather than quietly serving a roster that is
# months out of date.
run: |
curl -fsSL -o src/sponsors.json \
https://assets.phalcon.io/phalcon/sponsors.json \
|| echo "Download failed, no sponsors are rendered"
- 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}"