This repository holds all the assets that Phalcon sites use: the design tokens and the shared stylesheets, the sponsor and GitHub data, the images, logos and icons, and the assets of the Phalcon debug page. assets.phalcon.io serves them.
The site is built with Astro. The CI workflow (.github/workflows/main.yml) checks the PHP and runs the tests, builds the site, and publishes the build to the production branch, which Cloudflare Pages serves. It runs after every push and after each data workflow.
public/phalcon/,public/zephir/,public/debug/: the assets, served at/phalcon/…,/zephir/…and/debug/…. The other sites load them by address, so a file keeps its path and its bytes (npm run verifychecks it).public/phalcon/css/: the shared stylesheets of the sites:tokens.css(the design tokens),common.css(the shared nav and footer),sidebar.css(the shared sidebar) andcode-theme.json(the code theme).public/phalcon/footer.jsonandpublic/phalcon/sidebar.json: the links of the shared footer, and the titles and text of the shared sidebar.public/phalcon/tools/: the shared tools that each site gets before every build:design-checks.mjsanddesign-refresh.mjs(the checks and the refresh of the design files) andstars.mjs(the star count of the nav).scripts/: the generators of the data (generateSponsors.php,generateGithub.php, withsponsors/andgithub/), the roster script of the other repositories (updateBackers.php, withbackers/), the PHP checks of the shared files (tokens/), the feed watch (watch-feeds.mjs, withwatch/), and the checks of the build (verify-build.mjs).tests/: the PHP tests (tokens.php,github.php,sponsors.php,backers.php) and the Node tests.src/: the page of the site (the shared nav, footer and sidebar).
sponsors.yml(daily):php scripts/generateSponsors.phpwritespublic/phalcon/sponsors.jsonfrom GitHub Sponsors, Open Collective andscripts/sponsors/partners.json.github-data.yml(daily):php scripts/generateGithub.phpwritespublic/phalcon/repositories.jsonandpublic/phalcon/contributors.jsonfor the repositories ofscripts/github/repositories.json.
Each commits when its data changed. The CI workflow runs after each of them, so the new data is live some minutes later.
watch.yml (daily, 05:47 UTC) checks that the feeds are current: the last scheduled runs of the two data workflows passed and are less than 26 hours old, the last CI run on master passed, and the live feeds are the files of master. When a check fails, it opens the issue "The assets feeds need attention" (or adds a comment to the open one) and the run fails. When every check passes again, it closes the issue. A failed scheduled run of a data workflow stays a problem until a re-run of that run passes: a manual run of the workflow does not clear it, because the watch reads only the scheduled runs. The checks are in scripts/watch/checks.mjs. To see the state now, with the files of master in the working tree (after git pull): docker run --rm -v "$PWD:/app" -w /app node:26-alpine node scripts/watch-feeds.mjs --dry-run.
backers.yml is a reusable workflow. It runs php scripts/updateBackers.php on a file of the repository that calls it (README.md by default). The script replaces the text between <!-- backers:start --> and <!-- backers:end --> with the roster of https://assets.phalcon.io/phalcon/sponsors.json. When the file changed, the workflow pushes the change to the branch backers-roster-update and opens a pull request Updating the backers roster. There is at most one open pull request: a new change replaces the change of an earlier run, and when the roster is the same as on the base branch again, the workflow closes the pull request. The repository must allow GitHub Actions to create pull requests (Settings, Actions, General).
A repository calls it every day, one hour after the roster job:
name: Update backers
on:
schedule:
- cron: "17 5 * * *"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
backers:
uses: phalcon/assets/.github/workflows/backers.yml@<commit SHA> # master
# Only when the file is not README.md:
with:
file: BACKERS.mdThe workflow runs the script of the commit that the caller pins. When the script changes, change the SHA in each caller.
The tools run in Docker:
- Install:
docker run --rm -v "$PWD:/app" -w /app node:26-alpine npm ci - Tests:
docker run --rm -v "$PWD:/app" -w /app node:26-alpine npm test - PHP tests:
docker run --rm -v "$PWD:/app" -w /app php:8.4-cli sh -c 'php tests/tokens.php && php tests/github.php && php tests/sponsors.php && php tests/backers.php' - PHP analyzers:
phpcs(PSR-12,phpcs.xml) andphpstan analyse(level max,phpstan.neon). - Build and checks:
docker run --rm -v "$PWD:/app" -w /app node:26-alpine sh -c 'npm run build && npm run verify' - Preview:
docker run --rm -p 4321:4321 -v "$PWD:/app" -w /app node:26-alpine npx astro preview --host 0.0.0.0
docs-kit/ is the package @phalcon/docs-kit: the shared base of the Phalcon documentation sites (Astro and nimbus-docs). It has the components, the layouts, the styles, the routes, the scripts and the docs-kit command. A site keeps its values, its pages and its sidebars, and pins a kit version. docs-kit/README.md is the guide for a site.
Two ways of updating in this repository.
public/is live: assets.phalcon.io serves it, and a change is on all sites at once (their next build downloads it).docs-kit/is pinned: a site gets a change of the kit only with a new kit version in itsdocs/package.json.- Nothing of
docs-kit/ordocs-kit-fixture/is published on assets.phalcon.io.
Local commands. There are no tools on the host: docs-kit/run runs a command in the phalcon-docs image, and builds the image when it does not exist. It mounts the root of the repository at /repo and works in docs-kit/, or in the folder of --in <path>. The temp files and the pnpm store are in .tmp/ (ignored by git).
- Install:
docs-kit/run pnpm install - Tests:
docs-kit/run pnpm test - The fixture site (
docs-kit-fixture/: a stable version, a pre-release and a deprecated version), withdocs-kit/run --in docs-kit-fixture/docsbefore each command:- after a kit change,
pnpm install --force(the fixture has a copy of the kit); pnpm build,pnpm test,pnpm lint:docs,pnpm exec docs-kit nimbus check,pnpm typecheck.
- after a kit change,
- The sites on the kit (
docs-kit/sites.json), built and checked with the packed kit of the work tree:docs-kit/run node scripts/check-sites.mjs [name]. - The compare of two builds:
docs-kit/run node scripts/compare-dist.mjs /repo/<dist> /repo/<dist>.
CI. .github/workflows/docs-kit.yml runs on a change of the kit, of the fixture or of the three docs workflows:
kit: the tests of the kit;fixture: the shared workflow (.github/workflows/docs-site.yml) on the fixture, with no publish;sites: each site ofsites.json, built with the packed kit of the commit. A failed build or check fails the run. The compare with the build on the pinned kit of the site is in the job summary: read it before the merge;install: a copy of the fixture builds, checks, type-checks and lints with the packed kit of the commit (pnpm pack: the file of a release), from a new lock into an empty store, as the CI of a site does. A file that thefileslist ofdocs-kit/package.jsonleaves out fails here (thekitandfixturejobs use the kit folder).
.github/workflows/docs-kit-release.yml runs on the push of a kit-v* tag: see "Release a kit version".
Update nimbus-docs. The kit pins nimbus-docs to an exact version, because a nimbus update is code work. The update run of the team reports a new version as kit work. On a branch:
-
Set the new version of
@cloudflare/nimbus-docsindocs-kit/package.json, thendocs-kit/run pnpm install. -
docs-kit/run pnpm exec nimbus-docs migrate --dry-runlists the reviews of the upgrade. Make them in the kit. A review that namesastro.config.tsapplies todocs-kit/config.mjsanddocs-kit/starter/shared/astro.config.ts. -
docs-kit/run pnpm exec nimbus-docs migrate --yesrecords the version indocs-kit/nimbus.json. -
docs-kit/run pnpm exec nimbus-docs outdatedlists the registry components and the starter files that changed upstream;docs-kit/run pnpm exec nimbus-docs diff <file>shows one. Take the changes that the sites need. -
Run the tests, then the fixture:
docs-kit/run --in docs-kit-fixture/docs pnpm install: the fixture lock records the dependencies of the kit, and the fixture must build on the new nimbus;docs-kit/run --in docs-kit-fixture/docs pnpm exec docs-kit sync(it copies the newnimbus.json), the build and the checks.
Then
check-sites.mjs. For a large change, compare the fixture build before and after withcompare-dist.mjs. -
Commit the two lock files,
docs-kit/pnpm-lock.yamlanddocs-kit-fixture/docs/pnpm-lock.yaml(a kit test checks that both have the nimbus version of the kit). Write the kit changelog, then release (below).
If a review needs a site, run migrate in the fixture (docs-kit/run --in docs-kit-fixture/docs pnpm exec nimbus-docs migrate --dry-run) and copy its nimbus.json to docs-kit/.
Release a kit version.
-
In the pull request:
- set the version in
docs-kit/package.json; - add a section to
docs-kit/CHANGELOG.md, with the date of the release in place of(unreleased)when you know it; - change the kit pin of a new site to the new release:
docs-kit/starter/new/package.json(https://github.com/phalcon/assets/releases/download/kit-vX.Y.Z/phalcon-docs-kit-X.Y.Z.tgz) and the comment ofdocs-kit/starter/new/docs.yml(# kit-vX.Y.Z; its commit stays aTODO, a new site takes it from the tag). A kit test checks both.
The version: major when a site must change a file that it writes by hand, minor for a new feature, patch for a fix. Say so in the changelog when a file of
docs-kit/starter/shared/changes. - set the version in
-
After the merge, when the CI of the merge commit is green, tag the merge commit and push the tag. Only an organization admin can create, move or delete a
kit-v*tag (the tag rulesetkit-tags).git tag kit-vX.Y.Z <merge commit> git push origin kit-vX.Y.Z
The tag push starts
.github/workflows/docs-kit-release.yml. Itsreleasejob checks that the tag is the version ofdocs-kit/package.jsonand that the starter pins the release of the tag. Then it packs the kit, makes the release with the filephalcon-docs-kit-X.Y.Z.tgzand the notes of the version indocs-kit/CHANGELOG.md, and checks that the release cannot change. Itscheckjob, which cannot write, compares the file at the release address with the packed file, and installs a new site from that address. If the run fails:- in the
releasejob, before the stepMake the release(a wrong tag, a starter that pins another release, no changelog section): there is no release. Delete the tag (git push origin :refs/tags/kit-vX.Y.Z, thengit tag -d kit-vX.Y.Z), fix the cause in a pull request, then tag again; - in the step
Make the release, because the release can change (release immutability is off): delete the release and the tag, turn on release immutability, then tag again; - in the
checkjob, because of the network: run the failed job again; - in the
checkjob, because the file is not the packed file or a new site cannot install it: the release is bad. A release cannot change (release immutability): fix it with a new patch version.
- in the
-
The commit of the tag, for the caller pin of a site (
uses: phalcon/assets/.github/workflows/docs-site.yml@<commit> # kit-vX.Y.Z):git rev-parse kit-vX.Y.Z^{commit}.
How the sites get a new kit version. The update scripts of the team support the kit after a later change of phalcon/team. Then the next update-all-projects run changes the kit version of each site: docs/package.json (the release address), the caller .github/workflows/docs.yml, the lock file, and the synced files (docs-kit sync). The CI of each site builds and checks the change. A new major kit version is reported, not written: --major phalcon/assets writes it. Until then, change the two pins of a site by hand, then run pnpm install and pnpm exec docs-kit sync in its docs/.
- To change a color, change
public/phalcon/css/tokens.css. The PHP checks (tests/tokens.php) and the Node tests check the shared files; the other sites get them on their next CI run. public/css/site.csshas the rules of this site. Use a color through the tokens:var(--nd-…)orvar(--ph-…).npm testfails on a typed color inpublic/css/site.cssandsrc/.- The nav (
src/components/Header.astro) and the footer (src/components/Footer.astro) are the ones of phalcon.io, with the classes ofcommon.css.public/js/nav.jsis a copy of the mobile menu script of phalcon.io.
Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]
Support us with a monthly donation and help us continue our activities. [Become a backer]