Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 159 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: Release

on:
push:
tags:
- "v*"

permissions: {}

concurrency:
group: release-${{ github.ref_name }}
cancel-in-progress: false

jobs:
build:
name: Verify and build release
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Verify release tag
env:
RELEASE_TAG: ${{ github.ref_name }}
run: |
[[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[1-9][0-9]*)?$ ]]
test "$(git rev-parse HEAD)" = "$(git rev-parse "refs/tags/$RELEASE_TAG^{commit}")"

- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
check-latest: true
cache: npm

- name: Install dependencies without lifecycle scripts
run: npm ci --ignore-scripts

- name: Audit dependencies
run: npm audit --audit-level=moderate

- name: Type-check
run: npm run typecheck

- name: Check formatting
run: npm run lint

- name: Run unit tests
run: npm test

- name: Test release validation and packaging
run: npm run test:release

- name: Build extension
run: npm run build

- name: Prepare release metadata
env:
RELEASE_TAG: ${{ github.ref_name }}
run: bash scripts/prepare-release.sh "$RELEASE_TAG"

- name: Install test browser
run: npm exec --no -- playwright install --with-deps chromium

- name: Run Chromium extension tests
run: npm run test:e2e

- name: Package extension
run: bash scripts/package.sh

- name: Upload verified release assets
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: github-status-extension
path: artifacts/*
if-no-files-found: error
retention-days: 14

- name: Upload browser failure diagnostics
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: failure()
with:
name: browser-test-results
path: test-results/
if-no-files-found: ignore
retention-days: 7

publish:
name: Publish GitHub release
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
steps:
- name: Download verified release assets
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: github-status-extension
path: artifacts

- name: Verify package checksum
working-directory: artifacts
run: shasum -a 256 -c ./*.sha256

- name: Create draft release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.ref_name }}
run: |
[[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[1-9][0-9]*)?$ ]]
release_flags=(--latest=false)
if [[ "$RELEASE_TAG" == *-rc.* ]]; then
release_flags+=(--prerelease)
else
release_flags=(--latest)
fi
cat > "$RUNNER_TEMP/release-notes.md" <<'NOTES'
Download the ZIP and its SHA-256 checksum below. Extract the ZIP to a folder, open chrome://extensions, enable Developer mode, and choose Load unpacked to select that folder.

This release is for manual installation. It is not published to the Chrome Web Store. GitHub is the only supported provider in this version.
NOTES
gh release create "$RELEASE_TAG" --draft \
--verify-tag --title "$RELEASE_TAG" \
--notes-file "$RUNNER_TEMP/release-notes.md" \
--generate-notes "${release_flags[@]}"

- name: Upload all release assets before publication
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.ref_name }}
run: gh release upload "$RELEASE_TAG" artifacts/*

- name: Verify uploaded assets
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.ref_name }}
run: |
gh release download "$RELEASE_TAG" --pattern '*.zip' --pattern '*.sha256' --dir "$RUNNER_TEMP/release-verification"
cd "$RUNNER_TEMP/release-verification"
shasum -a 256 -c ./*.sha256

- name: Publish immutable release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.ref_name }}
run: |
latest=true
if [[ "$RELEASE_TAG" == *-rc.* ]]; then
latest=false
fi
gh release edit "$RELEASE_TAG" --draft=false --latest="$latest"
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The first version includes the overall status, affected-first service list, acti

## Build and install

Requires Node.js 26 LTS or newer and npm. The `.nvmrc` file selects Node 26 for local development and CI; run `nvm install && nvm use` if you use nvm. Bash and zip are used for packaging.
Requires Node.js 26 LTS or newer and npm. The `.nvmrc` file selects Node 26 for local development and CI; run `nvm install && nvm use` if you use nvm. Bash, jq, zip, and shasum are used for packaging.

```bash
npm ci --ignore-scripts
Expand All @@ -19,14 +19,33 @@ Open `chrome://extensions`, enable **Developer mode**, choose **Load unpacked**,
npm run package
```

The distributable is `artifacts/github-status-extension-0.1.0.zip`. It contains compiled extension code and assets only. It is not automatically published to the Chrome Web Store.
The distributable is `artifacts/github-status-extension-0.1.0.zip`, accompanied by a `.zip.sha256` checksum. It contains compiled extension code and assets only. It is not automatically published to the Chrome Web Store.

## Releases and release candidates

Push a tag matching the version in both `package.json` and `public/manifest.json`: `v0.1.0` for a stable release, or `v0.1.0-rc.1` for a release candidate. The dedicated Release workflow runs its own validation, tests, and build without calling CI, stamps `version_name` into the built manifest, and publishes the ZIP and SHA-256 checksum to GitHub Releases. RC tags are marked as prereleases and do not become the latest stable release. Chrome's numeric `version` remains `0.1.0` for this release series.

The dedicated Release workflow runs only when a version tag is pushed; it has no manual trigger. It verifies the tag points at the checked-out source and refuses version mismatches. Only the publishing job has repository write permissions; it downloads the tested artifact and verifies the checksum without checking out or executing project code.

The repository enables release immutability. Publication creates a draft, uploads every asset, downloads and verifies the uploaded package, and only then publishes the draft. Published assets and tags are never replaced. If publication fails, the release stays unpublished; fix the issue and cut a new RC instead of overwriting assets. Future cosign signatures must be included before publication.

To test a published RC, download and extract its ZIP, open `chrome://extensions`, enable **Developer mode**, and choose **Load unpacked** with the extracted directory. To verify the download, put the ZIP and checksum in the same directory and run `shasum -a 256 -c github-status-extension-0.1.0-rc.1.zip.sha256`.

To prepare an RC locally without publishing:

```bash
npm run build
bash scripts/prepare-release.sh v0.1.0-rc.1
bash scripts/package.sh
```

## Validation

```bash
npm run typecheck
npm run lint
npm test
npm run test:release
npm run build
npx playwright install chromium
npm run test:e2e
Expand Down
48 changes: 15 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
"build": "bash scripts/build.sh",
"test": "tsc -p tsconfig.test.json && node --test .test/tests/*.test.js",
"test:e2e": "playwright test",
"test:release": "bash tests/release.test.sh",
"package": "npm run build && bash scripts/package.sh"
},
"devDependencies": {
"@playwright/test": "1.56.1",
"@playwright/test": "1.65.0",
"@types/chrome": "0.1.24",
"@types/node": "24.10.0",
"prettier": "3.6.2",
Expand Down
11 changes: 9 additions & 2 deletions scripts/package.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
package_version=$(jq -er '.version_name // .version' dist/manifest.json)
if [[ ! "$package_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[1-9][0-9]*)?$ ]]; then
echo 'Invalid package version' >&2
exit 1
fi
mkdir -p artifacts
rm -f artifacts/github-status-extension-0.1.0.zip
(cd dist && zip -qr ../artifacts/github-status-extension-0.1.0.zip .)
archive="github-status-extension-$package_version.zip"
rm -f "artifacts/$archive"
(cd dist && zip -qr "../artifacts/$archive" .)
(cd artifacts && shasum -a 256 "$archive" > "$archive.sha256")
18 changes: 18 additions & 0 deletions scripts/prepare-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
release_tag=${1:?Usage: prepare-release.sh vX.Y.Z[-rc.N]}
if [[ ! "$release_tag" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)(-rc\.[1-9][0-9]*)?$ ]]; then
echo 'Expected a tag in the form vX.Y.Z or vX.Y.Z-rc.N' >&2
exit 1
fi
base_version=${BASH_REMATCH[1]}
package_version=$(jq -er .version package.json)
manifest_version=$(jq -er .version dist/manifest.json)
if [[ "$package_version" != "$base_version" || "$manifest_version" != "$base_version" ]]; then
echo 'Tag, package.json, and manifest.json versions must match' >&2
exit 1
fi
# Chrome requires a numeric version; version_name carries the RC suffix.
jq --arg version "${release_tag#v}" '.version_name = $version' dist/manifest.json > dist/manifest.release.json
mv dist/manifest.release.json dist/manifest.json
39 changes: 39 additions & 0 deletions tests/release.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -euo pipefail
project_dir=$(cd "$(dirname "$0")/.." && pwd)
test_dir=$(mktemp -d)
trap 'rm -rf "$test_dir"' EXIT
mkdir -p "$test_dir/scripts" "$test_dir/dist"
cp "$project_dir/scripts/prepare-release.sh" "$project_dir/scripts/package.sh" "$test_dir/scripts/"
printf '{"version":"0.1.0"}\n' > "$test_dir/package.json"
printf '{"version":"0.1.0","manifest_version":3}\n' > "$test_dir/dist/manifest.json"
cd "$test_dir"
for invalid in 'v0.1.0-rc.0' 'v0.1.0-beta.1' '0.1.0' 'v0.2.0' 'v0.1.0/../../x' 'v0.1.0;echo bad'; do
if bash scripts/prepare-release.sh "$invalid" >/dev/null 2>&1; then
echo "Unexpectedly accepted invalid release tag: $invalid" >&2
exit 1
fi
done
test "$(jq -r '.version_name // "missing"' dist/manifest.json)" = missing
bash scripts/prepare-release.sh v0.1.0-rc.1
test "$(jq -r .version dist/manifest.json)" = 0.1.0
test "$(jq -r .version_name dist/manifest.json)" = 0.1.0-rc.1
bash scripts/package.sh
(cd artifacts && shasum -a 256 -c github-status-extension-0.1.0-rc.1.zip.sha256)
test "$(unzip -p artifacts/github-status-extension-0.1.0-rc.1.zip manifest.json | jq -r .version_name)" = 0.1.0-rc.1
bash scripts/prepare-release.sh v0.1.0
bash scripts/package.sh
test -f artifacts/github-status-extension-0.1.0.zip
jq '.version = "0.2.0"' dist/manifest.json > dist/mismatch.json
mv dist/mismatch.json dist/manifest.json
if bash scripts/prepare-release.sh v0.1.0 >/dev/null 2>&1; then
echo 'Unexpectedly accepted mismatched manifest version' >&2
exit 1
fi
jq '.version_name = "../../bad"' dist/manifest.json > dist/invalid.json
mv dist/invalid.json dist/manifest.json
if bash scripts/package.sh >/dev/null 2>&1; then
echo 'Unexpectedly accepted invalid package filename' >&2
exit 1
fi
echo 'Release validation and packaging tests passed.'
Loading