Skip to content

nightly

nightly #98

Workflow file for this run

name: nightly
# Cuts a nightly prerelease so you can `brew update && brew upgrade --cask
# noetica-nightly` each morning. Pushes a dated nightly tag, which the `release`
# workflow builds (universal signed .dmg) and whose update-cask job points the
# noetica-nightly cask at the fresh build.
on:
schedule:
# 18:00 UTC daily = 2PM US Eastern during daylight time (1PM in winter — GitHub cron is
# UTC-only). Chosen so a day's merges are IN that day's nightly: the old 08:00 UTC cut
# fired before the workday, so every nightly shipped yesterday's main (the 2026-07-22
# cask-staleness incident). NB GitHub may delay scheduled runs up to ~2h under load.
- cron: "0 18 * * *"
workflow_dispatch: {}
permissions:
contents: write
jobs:
tag-nightly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
# A PAT (not the default GITHUB_TOKEN) is required: tags pushed with
# GITHUB_TOKEN do NOT trigger the release workflow (GitHub recursion
# guard). Reuses the existing cross-repo TAP token if RELEASE_PAT is unset.
token: ${{ secrets.RELEASE_PAT || secrets.TAP_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- name: Skip if no commits since last nightly
id: gate
run: |
LAST=$(git tag -l 'v*-nightly.*' --sort=-creatordate | head -1)
if [ -n "$LAST" ] && [ "$(git rev-list -n1 "$LAST")" = "$(git rev-parse HEAD)" ]; then
echo "HEAD unchanged since $LAST — skipping nightly"
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Create and push nightly tag
if: steps.gate.outputs.skip != 'true'
run: |
BASE=$(node -p "require('./package.json').version")
# VERSION IDENTITY GUARD: a released number is immutable. If v$BASE already exists
# as a published (non-prerelease) release, someone forgot the bump — fail loudly
# instead of re-wearing a spent number (the 0.4.23×7 incident, 2026-07-20..23).
if gh release view "v${BASE}" --json isPrerelease -q 'if .isPrerelease then "pre" else "stable" end' 2>/dev/null | grep -q stable; then
echo "::error::version ${BASE} is already released — bump package.json/tauri.conf.json before cutting nightlies"
exit 1
fi
TAG="v${BASE}-nightly.$(date -u +%Y%m%d)"
# If today's nightly tag already exists (manual re-run), append a counter.
if git rev-parse "$TAG" >/dev/null 2>&1; then
TAG="${TAG}.$(date -u +%H%M%S)"
fi
echo "Tagging $TAG"
git tag "$TAG"
git push origin "$TAG"