CI / build (pull_request) Failing after 9s
Two advisories landed in this tree in a single day — js-yaml in the morning, nanoid a couple of hours later. Neither had anything to do with a code change. A release gated on `npm audit` fails by calendar date, and it fails at the exact moment there is least time to judge whether a fix is safe. What ships from here is built HTML, CSS and JS. Astro, js-yaml and nanoid are build-time tools that never reach a visitor; the advisories in question need control over build inputs to matter, and an attacker with that has already won. So the release gate drops to `critical` — a tripwire for the catastrophic case, not a trigger for routine noise. Nothing is lowered anywhere else: ci.yml still blocks every PR at moderate, which is where there is time and context to fix. The new scheduled audit is what makes that safe rather than negligent. Monday mornings on Gitea, filing an internal issue when something turns up, with a dedup check so a weekly cron cannot open 52 copies. Learning about a vulnerability and being unable to publish stop being the same event. `workflow_dispatch` is included so it can be run and verified on demand.
46 lines
1.8 KiB
YAML
46 lines
1.8 KiB
YAML
name: Release → dist.tar.gz
|
|
|
|
# Production artifact. Runs on GITHUB ONLY, on a version tag. Builds the static site
|
|
# and packages dist/ as a .tar.gz attached to the GitHub release — the cPanel deploy
|
|
# pulls that artifact.
|
|
on:
|
|
push:
|
|
tags: ['v*']
|
|
|
|
jobs:
|
|
package:
|
|
if: ${{ github.server_url == 'https://github.com' }}
|
|
permissions:
|
|
contents: write
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
ARCHIVE_NAME: green-tea-site-${{ github.ref_name }}.tar.gz
|
|
RELEASE_TAG: ${{ github.ref_name }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
- name: Validate release tag
|
|
run: npm run verify:release
|
|
- run: npm ci
|
|
# Deliberately `critical`, not `moderate`. npm audit reads a live advisory feed,
|
|
# so a release gated on it fails by calendar date rather than by anything the
|
|
# release changed — and it fails at the exact moment there is least time to judge
|
|
# whether a fix is safe. What ships here is built HTML, CSS and JS: Astro, js-yaml
|
|
# and friends are build-time tools that never reach a visitor. `critical` keeps a
|
|
# tripwire for the catastrophic case without breaking releases on routine noise.
|
|
# Moderate and up still gate every PR in ci.yml, and audit.yml files an issue on a
|
|
# schedule, so advisories still surface — just not as a broken release.
|
|
- run: npm audit --audit-level=critical
|
|
- run: npm run check
|
|
- name: Package dist/
|
|
run: tar -czf "$ARCHIVE_NAME" -C dist .
|
|
- name: Verify .htaccess in archive
|
|
run: tar -tzf "$ARCHIVE_NAME" | grep -Fx './.htaccess'
|
|
- name: Attach to GitHub release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
prerelease: true
|
|
files: ${{ env.ARCHIVE_NAME }}
|