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
164 changes: 164 additions & 0 deletions .github/workflows/extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: Extension Build & Chrome Web Store Publish

on:
pull_request:
paths:
- 'manifest.json'
- 'src/**'
- 'icons/**'
- 'scripts/**'
- '.github/workflows/extension.yml'
push:
branches:
- master
paths:
- 'manifest.json'
- 'src/**'
- 'icons/**'
workflow_dispatch:
inputs:
publish_type:
description: 'DEFAULT_PUBLISH goes live after review; STAGED_PUBLISH waits for a manual publish in the dashboard'
type: choice
options:
- DEFAULT_PUBLISH
- STAGED_PUBLISH
default: DEFAULT_PUBLISH
cancel_pending:
description: 'Cancel an older submission that is still in review and replace it'
type: boolean
default: false

permissions:
contents: read

concurrency:
group: extension-${{ github.ref }}
# Never interrupt a store upload halfway; superseded PR runs can be cancelled
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
build:
name: Validate & package
runs-on: ubuntu-latest
outputs:
version: ${{ steps.package.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Require a version bump when extension code changes
if: github.event_name == 'pull_request'
env:
BASE_REF: ${{ github.base_ref }}
run: |
changed=$(git diff --name-only "origin/${BASE_REF}...HEAD" -- manifest.json src icons)
if [ -z "$changed" ]; then
echo "No shipped files changed; version bump not required."
exit 0
fi
base_version=$(git show "origin/${BASE_REF}:manifest.json" | node -e "process.stdout.write(JSON.parse(require('fs').readFileSync(0,'utf8')).version)")
head_version=$(node -p "require('./manifest.json').version")
echo "Base v${base_version} -> PR v${head_version}"
newer=$(node -e "
const [a, b] = process.argv.slice(1).map(v => v.split('.').map(Number));
let r = 0;
for (let i = 0; i < 4 && r === 0; i++) r = Math.sign((a[i] || 0) - (b[i] || 0));
process.stdout.write(String(r > 0));
" "$head_version" "$base_version")
if [ "$newer" != "true" ]; then
echo "::error file=manifest.json::Extension files changed but v${head_version} is not higher than v${base_version} on ${BASE_REF}. Bump \"version\" in manifest.json so the merge ships to the Chrome Web Store."
exit 1
fi

- name: Validate and package extension
id: package
run: |
zip_path=$(node scripts/build-extension.mjs --out dist | tail -n 1)
echo "zip=${zip_path}" >> "$GITHUB_OUTPUT"
echo "version=$(node -p "require('./manifest.json').version")" >> "$GITHUB_OUTPUT"

- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: tabstack-extension
path: dist/*.zip
if-no-files-found: error
retention-days: 30

publish:
name: Publish to Chrome Web Store
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
environment:
name: chrome-web-store
url: https://chromewebstore.google.com/detail/tabstack/${{ vars.CWS_EXTENSION_ID || 'pnjlcnpebjggdmkhbopnibjgechfbfjg' }}
permissions:
contents: write # create the GitHub release for the shipped version
env:
CWS_PUBLISHER_ID: ${{ secrets.CWS_PUBLISHER_ID }}
CWS_EXTENSION_ID: ${{ vars.CWS_EXTENSION_ID || 'pnjlcnpebjggdmkhbopnibjgechfbfjg' }}
CWS_SERVICE_ACCOUNT_JSON: ${{ secrets.CWS_SERVICE_ACCOUNT_JSON }}
CWS_CLIENT_ID: ${{ secrets.CWS_CLIENT_ID }}
CWS_CLIENT_SECRET: ${{ secrets.CWS_CLIENT_SECRET }}
CWS_REFRESH_TOKEN: ${{ secrets.CWS_REFRESH_TOKEN }}
CWS_PUBLISH_TYPE: ${{ inputs.publish_type || 'DEFAULT_PUBLISH' }}
CWS_CANCEL_PENDING: ${{ inputs.cancel_pending && 'true' || 'false' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Check store credentials
id: creds
run: |
if [ -z "$CWS_PUBLISHER_ID" ] || { [ -z "$CWS_SERVICE_ACCOUNT_JSON" ] && [ -z "$CWS_REFRESH_TOKEN" ]; }; then
echo "::warning::Chrome Web Store secrets are not configured, so nothing was published. See docs/PUBLISHING.md."
echo "configured=false" >> "$GITHUB_OUTPUT"
else
echo "configured=true" >> "$GITHUB_OUTPUT"
fi

- name: Compare with store version
id: check
if: steps.creds.outputs.configured == 'true'
run: node scripts/cws-publish.mjs check

- name: Download package artifact
if: steps.check.outputs.should_publish == 'true'
uses: actions/download-artifact@v4
with:
name: tabstack-extension
path: dist

- name: Upload and submit for review
id: publish
if: steps.check.outputs.should_publish == 'true'
run: node scripts/cws-publish.mjs publish "dist/tabstack-${{ needs.build.outputs.version }}.zip"

- name: Create GitHub release
if: steps.publish.outputs.submitted_version != ''
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.publish.outputs.submitted_version }}
run: |
if gh release view "v${VERSION}" >/dev/null 2>&1; then
echo "Release v${VERSION} already exists"
else
gh release create "v${VERSION}" "dist/tabstack-${VERSION}.zip" \
--target "${GITHUB_SHA}" \
--title "TabStack v${VERSION}" \
--generate-notes
fi
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<p align="center">
<strong>Smart Tab Auto-Collapse & RAM Saver for Chromium Browsers</strong><br />
Automatically clusters same-site tabs into native collapsible groups, expands only your active stack (Accordion Mode), and frees system memory.
Automatically clusters same-site tabs into native collapsible groups, expands only your active stack (Accordion Mode), frees system memory, and brings back windows you close by mistake.
</p>

<p align="center">
Expand Down Expand Up @@ -64,7 +64,14 @@ Configure custom hibernation timeouts, root vs. subdomain grouping, minimum tab
<img src="docs/images/tabstack-options-settings.png" alt="TabStack Options & Whitelist" width="60%" />
</p>

### 5. 🧼 Clean, Minimal & Clutter-Free UI
### 5. 🕘 Session Snapshots (Never Lose a Window Again)
Closed the wrong window? TabStack keeps a local copy of every open window and saves it the moment the window closes. It also takes periodic snapshots (every 1h, 3h, 6h, 24h or 7 days) and keeps the session that was open before the browser last restarted. Open the **Sessions** tab in the popup and click **Restore** to reopen the tabs in a new window with pinned tabs and tab groups (names, colors, collapsed state) intact. Snapshots can be exported to and imported from JSON in Settings.

<p align="center">
<img src="docs/images/tabstack-session-snapshots.png" alt="TabStack Session Snapshots" width="48%" />
</p>

### 6. 🧼 Clean, Minimal & Clutter-Free UI
Designed with an intuitive, distraction-free interface that gets completely out of your way. Fast, accessible, lightweight, and works seamlessly out of the box with zero complex setup.

---
Expand All @@ -85,6 +92,7 @@ Designed with an intuitive, distraction-free interface that gets completely out

* **Zero Injected Content Scripts:** TabStack never touches or inspects webpage DOM contents.
* **100% Local Execution:** No remote analytics, tracking pixels, or data collection. Your open tabs and browsing history never leave your machine.
* **Local-Only Snapshots:** Session snapshots (tab URLs, titles and group names) are stored in your browser's extension storage and are never uploaded. Turn them off or delete them anytime in Settings.
* **Lightweight Service Worker:** Event-driven architecture with debounced operations (150ms) to ensure 0% CPU overhead.

---
Expand All @@ -106,6 +114,9 @@ Get TabStack directly from the official store:
3. Enable **Developer mode** in the top-right corner.
4. Click **Load unpacked** and select the root `tabstack/` folder.

### Releasing
Merging a version bump to `master` publishes it automatically: GitHub Actions validates and packages the extension, uploads it to the Chrome Web Store through the v2 API, and submits it for review. PRs that change extension code must bump `"version"` in `manifest.json`. One-time credential setup is in **[docs/PUBLISHING.md](docs/PUBLISHING.md)**.

### Running the Landing Page Locally
```bash
cd landing
Expand Down
94 changes: 94 additions & 0 deletions docs/PUBLISHING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Publishing to the Chrome Web Store

Merges to `master` that touch the extension (`manifest.json`, `src/`, `icons/`) are uploaded to the Chrome Web Store and submitted for review automatically by [`.github/workflows/extension.yml`](../.github/workflows/extension.yml). It uses the [Chrome Web Store API v2](https://developer.chrome.com/docs/webstore/using-api). The v1 API stops working on October 15, 2026.

## How a release flows

1. **Open a PR** that changes the extension and bumps `"version"` in `manifest.json`. The PR check fails if extension files changed but the version isn't higher than `master`'s.
2. **CI validates and packages** the extension: manifest sanity checks, a syntax check of every script, and a zip of `manifest.json`, `src/` and `icons/` attached to the run as an artifact.
3. **Merge.** The publish job compares the manifest version with the store:
- newer than the published and pending versions: uploads the zip and submits it for review
- already published or already in review: skips, with the reason in the job summary
4. **Google reviews the update.** It goes live automatically when approved (usually within a few days).
5. A **GitHub Release** `vX.Y.Z` is created with the submitted zip attached.

Merges that only touch the landing page, docs or README never publish. The landing page has its own workflow (`deploy.yml`).

## One-time setup

You need your **Publisher ID** from the [Developer Dashboard](https://chrome.google.com/webstore/devconsole) under **Account → Publisher settings**. The publishing Google account must have 2-step verification turned on.

Then pick **one** of the two auth methods below.

### Option A: Service account (recommended)

Service account keys don't expire, and they aren't tied to your personal Google login.

1. In the [Google Cloud Console](https://console.cloud.google.com), create or pick a project and **enable the "Chrome Web Store API"**.
2. Go to **IAM & Admin → Service accounts** and create a service account. It doesn't need any IAM roles.
3. Open the service account, go to **Keys → Add key → Create new key → JSON**, and download the file.
4. In the Chrome Web Store [Developer Dashboard](https://chrome.google.com/webstore/devconsole), go to **Account**, find the service account section, and add the service account's email address. Only one service account can be added per publisher.
5. Add the secrets to the `chrome-web-store` environment (the commands are under [Add the GitHub secrets](#add-the-github-secrets)):
- `CWS_PUBLISHER_ID`
- `CWS_SERVICE_ACCOUNT_JSON`: the full contents of the JSON key file

If your Google Cloud organization blocks service account key creation, use Option B.

### Option B: OAuth client + refresh token

1. In the Cloud Console, **enable the "Chrome Web Store API"**.
2. Configure the **OAuth consent screen** (External), then **publish the app to "In production"**. While the app is in "Testing", refresh tokens expire after 7 days and the pipeline starts failing.
3. Create an **OAuth client ID** of type *Web application* with the authorized redirect URI `https://developers.google.com/oauthplayground`.
4. Open the [OAuth Playground](https://developers.google.com/oauthplayground). Click the gear icon, tick **Use your own OAuth credentials**, and enter your client ID and secret. Authorize the scope `https://www.googleapis.com/auth/chromewebstore` with the publisher account, then click **Exchange authorization code for tokens** and copy the **refresh token**.
5. Add the secrets to the `chrome-web-store` environment:
- `CWS_PUBLISHER_ID`
- `CWS_CLIENT_ID`
- `CWS_CLIENT_SECRET`
- `CWS_REFRESH_TOKEN`

### Add the GitHub secrets

You can add them in **Settings → Environments → New environment → `chrome-web-store`**, or with the GitHub CLI:

```bash
gh secret set CWS_PUBLISHER_ID --env chrome-web-store --repo YarooqH/tabstack
```

```bash
gh secret set CWS_SERVICE_ACCOUNT_JSON --env chrome-web-store --repo YarooqH/tabstack < path/to/service-account-key.json
```

Optional:
- **Required reviewers** on the `chrome-web-store` environment, to approve each store submission by hand before it runs.
- A repository **variable** `CWS_EXTENSION_ID` if the store item ID ever changes. It defaults to `pnjlcnpebjggdmkhbopnibjgechfbfjg`.

Until the secrets exist, the publish job skips with a warning instead of failing.

## Running it manually

**Actions → Extension Build & Chrome Web Store Publish → Run workflow** on `master` offers two options:

- **publish_type**: `STAGED_PUBLISH` holds the update after review approval until you click Publish in the dashboard. `DEFAULT_PUBLISH` (the default) goes live as soon as it's approved.
- **cancel_pending**: cancels an older version that is still in review and submits the current one instead. Without it, the job stops and tells you a submission is already pending.

## Local commands

```bash
node scripts/build-extension.mjs
```

This validates the extension and writes `dist/tabstack-<version>.zip`. It needs the `zip` CLI.

```bash
CWS_PUBLISHER_ID=... CWS_EXTENSION_ID=pnjlcnpebjggdmkhbopnibjgechfbfjg CWS_SERVICE_ACCOUNT_JSON="$(cat key.json)" node scripts/cws-publish.mjs check
```

This compares `manifest.json` with what's in the store and changes nothing.

## What the pipeline does not update

The API only uploads packages. Do these in the Developer Dashboard when they change:

- Store listing text, screenshots and promo images
- **Privacy practices**: permission justifications and data-usage disclosures. For example, a newly added permission such as `unlimitedStorage` needs a justification before review.
- Distribution and visibility settings
Binary file added docs/images/tabstack-session-snapshots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions landing/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,9 @@ function setupCompareSlider() {

function setupStickyStorytelling() {
const stepBlocks = document.querySelectorAll('.story-step-block');
const visualPanes = {
1: document.getElementById('visualPane-1'),
2: document.getElementById('visualPane-2'),
3: document.getElementById('visualPane-3')
};
const visualPanes = Object.fromEntries(
[...document.querySelectorAll('.story-visual-pane')].map(pane => [pane.id.replace('visualPane-', ''), pane])
);

if (!stepBlocks.length) return;

Expand Down
Loading
Loading