diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 44b30ba..907e8d8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -35,6 +35,9 @@ jobs: - name: Regenerate milestones-data.js from YAML run: npm run build:milestones + - name: Regenerate changelog-data.js from CHANGELOG.md + run: npm run build:changelog + - name: Deploy to GitHub Pages (gh-pages branch) uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 with: diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..ad13693 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,29 @@ +name: Release Please + +on: + push: + branches: [main] + +# Prevent concurrent release-please runs; a new push cancels the in-progress job. +concurrency: + group: release-please + cancel-in-progress: true + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.rp.outputs.release_created }} + tag_name: ${{ steps.rp.outputs.tag_name }} + steps: + - name: Run Release Please + id: rp + uses: googleapis/release-please-action@5792afc6b46e9bb55deda9eda973a18c226bc3fc # v4.1.5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + config-file: release-please-config.json + manifest-file: .release-please-manifest.json diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..37fcefa --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.0.0" +} diff --git a/AGENTS.md b/AGENTS.md index 4c47568..a7bea40 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,12 +23,17 @@ a Chart.js growth chart with projections, and a prompt/PR quality scoring sectio ├── styles.css ← Dark/light theme, animations, responsive layout ├── death-clock-core.js ← Pure functions only — no DOM, safe to unit-test ├── script.js ← All DOM manipulation, Chart.js wiring, RAF loop -├── package.json ← Jest config & devDependencies (no runtime deps) +├── changelog-data.js ← AUTO-GENERATED from CHANGELOG.md — do not edit +├── milestones-data.js ← AUTO-GENERATED from milestones.yaml — do not edit +├── package.json ← version, Jest config & devDependencies (no runtime deps) +├── release-please-config.json ← release-please release automation config +├── .release-please-manifest.json ← release-please version manifest ├── tests/ │ └── death-clock.test.js ← 75 Jest unit tests for death-clock-core.js └── .github/ └── workflows/ ├── deploy.yml ← Deploys site to gh-pages branch (production) on push to main + ├── release-please.yml ← Creates release PRs + GitHub Releases via release-please ├── preview.yml ← Deploys PR preview to previews/pr-N/ and posts URL comment ├── preview-cleanup.yml ← Removes preview directory when a PR is closed ├── unit-tests.yml ← Runs `npm run test:ci` + uploads coverage to Codecov @@ -103,6 +108,25 @@ Merging to `main` triggers the `deploy.yml` workflow automatically. It pushes th **One-time repo setup required** (only needs to be done once by a maintainer): > Settings → Pages → Source → **Deploy from a branch** → Branch: `gh-pages` / `(root)` → Save. +### Releasing a new version + +This repo uses [release-please](https://github.com/googleapis/release-please) for automated semantic versioning and GitHub Releases. + +**How it works:** +1. Merge PRs to `main` using [Conventional Commits](https://www.conventionalcommits.org/) in the commit/PR title: + - `feat: …` → bumps **minor** version (e.g. `1.0.0` → `1.1.0`) + - `fix: …` → bumps **patch** version (e.g. `1.0.0` → `1.0.1`) + - `feat!: …` or `BREAKING CHANGE:` footer → bumps **major** version +2. `release-please.yml` automatically creates or updates a **Release PR** that: + - bumps `"version"` in `package.json` + - updates `CHANGELOG.md` with the new release section +3. When the Release PR is merged, release-please creates a **GitHub Release** + git tag (e.g. `v1.1.0`). +4. The `deploy.yml` workflow then re-deploys, regenerating `changelog-data.js` from the updated `CHANGELOG.md` so the site's **Changelog tab** reflects the new release. + +**Key files:** +- `release-please-config.json` — maps commit types to CHANGELOG sections, sets `release-type: node` +- `.release-please-manifest.json` — tracks the current released version; updated automatically by release-please + ### PR Preview URLs Every pull request automatically gets a live preview URL: - Triggered by `preview.yml` on `pull_request` (opened / synchronize / reopened) @@ -143,3 +167,5 @@ uses: actions/checkout@v6 - Do **not** skip tests when adding new pure functions to the core module. - Do **not** change `BASE_TOKENS` / `TOKENS_PER_SECOND` / `BASE_DATE_ISO` independently — update all three as a set with a comment explaining the source. - Do **not** use mutable tags (e.g. `@v6`) in `uses:` — always pin to a commit SHA with a full semver comment (e.g. `@abc1234... # v6.0.2`). +- Do **not** edit `changelog-data.js` or `milestones-data.js` directly — they are auto-generated; edit `CHANGELOG.md` / `milestones.yaml` and run the corresponding build script. +- Do **not** bump the version in `package.json` manually — let release-please handle it via Conventional Commits. diff --git a/changelog-data.js b/changelog-data.js new file mode 100644 index 0000000..ae0cf10 --- /dev/null +++ b/changelog-data.js @@ -0,0 +1,46 @@ +'use strict'; +// AUTO-GENERATED from CHANGELOG.md — do not edit directly. +// Run `npm run build:changelog` to regenerate from CHANGELOG.md. + +const SITE_VERSION = "1.0.0"; + +const CHANGELOG_RELEASES = [ + { + version: "Unreleased", + date: null, + sections: [ + { heading: "Added", items: [ + "`.nvmrc` to pin Node.js version to 20 LTS (matching CI)", + "`.editorconfig` for consistent editor formatting across contributors", + "`\"homepage\"` field in `package.json` pointing to the live GitHub Pages site", + "`CHANGELOG.md` to track releases going forward", + ] } + ], + }, + { + version: "1.0.0", + date: "2025-04-14", + sections: [ + { heading: "Added", items: [ + "Live global AI token counter anchored to `BASE_DATE_ISO` (not page-load time)", + "Session counter showing tokens consumed since the page was opened", + "7 environmental milestone cards (trees → bees → water → coral → glaciers → ocean → extinction)", + "Chart.js growth chart with 18-month log-scale projection", + "Predictions table with estimated dates for each milestone", + "Dark / light theme toggle (dark default)", + "Prompt & PR scoring section with collapsible rubric", + "Jest test suite with 75 tests and ≥ 80 % coverage thresholds", + "GitHub Actions CI workflow (`test.yml`) running on every push and PR", + "GitHub Actions deploy workflow (`deploy.yml`) publishing to GitHub Pages on merge to `main`", + "`AGENTS.md` with architecture rules and contributor guidance", + ] } + ], + }, +]; + +/* istanbul ignore next */ +if (typeof module !== 'undefined' && module.exports) { + module.exports = { SITE_VERSION, CHANGELOG_RELEASES }; +} else if (typeof window !== 'undefined') { + window.ChangelogData = { SITE_VERSION, CHANGELOG_RELEASES }; +} diff --git a/index.html b/index.html index 848a1b2..afe2364 100644 --- a/index.html +++ b/index.html @@ -70,6 +70,10 @@

AI DEATH CLOCK

aria-selected="false" aria-controls="tab-about" data-tab="about"> ℹ️ About + @@ -658,10 +662,35 @@

What You Can Do

+ + + + +