Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publishing Chrome Extension directly from Github

I have my chrome extension (the one's I authored) hosted on Google Chrome store. I did create a developer account (5$ one).

I'd like to link my chrome extension to it's github repository and automatically update it every-time I update the code instead of manually zipping it and uploading the zip file. Is there a way to do that? I couldn't find anything here https://developer.chrome.com/docs/webstore/publish/

There is a self hosting section but I don't think that helps with what I'm trying to. Has anyone figured out an automatic deployment from github to chrome store?

like image 676
sublime Avatar asked Dec 06 '25 10:12

sublime


2 Answers

You can consider using a GitHub Action, like for instance Chrome Extension upload & publish

That way, the zip/upload process will be automated.

Example:

uses: Klemensas/chrome-extension-upload-action@$VERSION
with:
  refresh-token: 'xxxxxxxxxxxxxxxxxxxxxx'
  client-id: 'xxxxxxxxxxxxx'
  client-secret: ${{ secrets.CHROME_EXTENSION_SECRET }}
  file-name: './extension.zip'
  app-id: 'xzc12xzc21cx23'
  publish: true

As commented by wOxxOm, make sure to set the client-secret value as a GitHub Secret, as shown here.
In the example above, I reference a secret named 'CHROME_EXTENSION_SECRET' that you must define first in your GitHub repository which has the sources of your extension:

${{ secrets.CHROME_EXTENSION_SECRET }}

https://github.com/Azure/actions-workflow-samples/raw/master/assets/images/Add-secret-name-value.png

like image 98
VonC Avatar answered Dec 09 '25 01:12

VonC


You should create your GitHub Actions workflow file in the .github/workflows/ directory in your project. Workflow will compress your extension and upload it using the API.

In the example below, you can see the steps of a GitHub Actions workflow file:

publish-chrome-extension.yml

name: Publish Chrome Extension

on:
  push:
    branches:
      - main
jobs:
  build_and_publish:
    runs-on: ubuntu-latest

steps:
  # 1. Checkout code from repository
  - name: Checkout repository
    uses: actions/checkout@v3

  # 2. Setup Node.js (If your extension is built with Node.js, otherwise skip this step)
  - name: Set up Node.js
    uses: actions/setup-node@v3
    with:
      node-version: '16'

  # 3. Install dependencies (If needed, for example for React or other build tools)
  - name: Install dependencies
    run: |
      npm install

  # 4. Build the extension (optional, depends on your setup)
  - name: Build extension
    run: |
      npm run build

  # 5. Package the extension as a zip file
  - name: Package extension
    run: |
      zip -r extension.zip ./build

  # 6. Upload extension to Chrome Web Store (using chrome-webstore-upload-cli)
  - name: Upload extension to Chrome Web Store
    env:
      CLIENT_ID: ${{ secrets.CHROME_WEBSTORE_CLIENT_ID }}
      CLIENT_SECRET: ${{ secrets.CHROME_WEBSTORE_CLIENT_SECRET }}
      REFRESH_TOKEN: ${{ secrets.CHROME_WEBSTORE_REFRESH_TOKEN }}
    run: |
      npm install -g chrome-webstore-upload-cli
      chrome-webstore-upload-cli --client-id $CLIENT_ID --client-secret $CLIENT_SECRET --refresh-token $REFRESH_TOKEN --extension-id your-extension-id --zip ./extension.zip
like image 37
cuneyd Avatar answered Dec 09 '25 00:12

cuneyd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!