This document explains how to set up automated publishing to the Chrome Web Store using GitHub Actions.
You need to configure the following secrets in your GitHub repository settings:
- Secret Name:
CHROME_EXTENSION_ID - Value: Your extension's ID from the Chrome Web Store
- How to find: Go to your extension's page in the Chrome Web Store, the ID is in the URL:
https://chrome.google.com/webstore/detail/[EXTENSION_ID]
You need to create a Google Cloud Project and enable the Chrome Web Store API:
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable the Chrome Web Store API
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth 2.0 Client IDs"
- Choose "Desktop application" as application type
- Note down the Client ID and Client Secret
Run this script locally to get your refresh token:
# Install dependencies
npm install -g chrome-webstore-upload-cli
# Get refresh token (replace with your credentials)
chrome-webstore-upload-cli \
--source ./build \
--extension-id YOUR_EXTENSION_ID \
--client-id YOUR_CLIENT_ID \
--client-secret YOUR_CLIENT_SECRET \
--auto-publishFollow the OAuth flow and copy the refresh token from the output.
Go to your GitHub repository > Settings > Secrets and variables > Actions, and add:
CHROME_EXTENSION_ID: Your extension IDCHROME_CLIENT_ID: OAuth 2.0 Client IDCHROME_CLIENT_SECRET: OAuth 2.0 Client SecretCHROME_REFRESH_TOKEN: Refresh token from step 3
The workflow runs on:
- Push to main/develop: Builds and tests the extension
- Pull requests: Runs tests only
- Tags starting with 'v': Builds, tests, creates release, and publishes to Web Store
- Manual trigger: Can be run manually from GitHub Actions tab
- Update version in
manifest.json - Commit and push changes
- Create and push a git tag:
git tag v1.2.3 && git push origin v1.2.3 - GitHub Actions will automatically build and publish to Chrome Web Store
- Go to GitHub Actions tab
- Select "Build Chrome Extension" workflow
- Click "Run workflow"
- Download the built extension from artifacts
- Manually upload to Chrome Web Store
The workflow creates:
- ZIP file: Ready-to-upload extension package
- GitHub Release: Automatic release with changelog
- Artifacts: Available for 30 days for manual download
- Invalid manifest.json: Check JSON syntax and required fields
- Missing secrets: Ensure all 4 secrets are configured correctly
- API quota exceeded: Chrome Web Store API has daily limits
- Version conflicts: Ensure version in manifest.json is higher than published version
- Check GitHub Actions logs for detailed error messages
- Verify all secrets are set correctly
- Test locally by building the extension manually
- Ensure your Google Cloud Project has Chrome Web Store API enabled
- Never commit API credentials to your repository
- Use GitHub Secrets for all sensitive information
- Regularly rotate your OAuth credentials
- Monitor your Google Cloud Project for unusual activity
For local testing:
# Install dependencies
bun install
# Run tests
bun test
# Create build directory and copy files
mkdir -p build
cp manifest.json popup.html popup.js background.js inject.js storage.js build/
cp -r assets build/ 2>/dev/null || true
# Create ZIP package
cd build && zip -r ../extension.zip . && cd ..