Giter Site home page Giter Site logo

plasmohq / bpp Goto Github PK

View Code? Open in Web Editor NEW
144.0 3.0 10.0 8.97 MB

๐Ÿš€ Browser Platform Publisher

License: MIT License

TypeScript 77.43% JavaScript 22.57%
chrome-extension chrome-extensions web-extensions browser-extension browser-extensions continuous-deployment continuous-integration actions json-schema firefox-addon

bpp's Introduction

plasmo logo

See License Follow PlasmoHQ on Twitter Watch our Live DEMO every Friday Join our Discord for support and chat about our projects typescript-action status

Browser Platform Publisher

A GitHub action from Plasmo to publish your browser extension to every web store/add-ons marketplace. This action and its dependencies are open-sourced under the MIT license. The core modules are:

Usage

In order to use this action, you will need to create a json file that contains the keys and optional configuration for each browser you wish to publish to.

To help you create it, we have provided a JSON schema that can be used with editors that support it, such as Visual Studio Code. This schema will provide intellisense and validation to ensure that your configuration is correct.

{
  "$schema": "https://github.com/PlasmoHQ/bpp/raw/main/keys.schema.json"
}

NOTE: You should only specify the browsers you wish to publish to. If there are any invalid configuration, the action will fail! I.e, no empty key allowed such as "chrome": {}.

Each browser option is made of the following:

  • Mandatory browser specific tokens (see token guide)

  • Optional parameters:

    • zip: The zip file containing the extension. The manifest.json file must be in the root of the zip file.

      {version} can be used in the name and will be replaced by the version from your versionFile.

    • file: An alias for the zip property.

    • verbose: Enable verbose logging for the specific browser.

    • versionFile: Relative path to a json file which has a version field. Defaults to package.json

    • notes: [Edge Only] Provide notes for certification to the Edge Add-ons reviewers.

The final json might look like this:

{
  "$schema": "https://github.com/PlasmoHQ/bpp/raw/main/keys.schema.json",
  "chrome": {
    "zip": "chromium_addon_{version}.zip",
    "clientId": "1280623",
    "clientSecret": "1!9us4",
    "refreshToken": "7&as$a89",
    "extId": "akszypg"
  },
  "firefox": {
    "file": "firefox_addon.xpi",
    "extId": "aaaaaaa-aaaa-bbbb-cccc-dddddddddddd",
    "apiKey": "ab214c4d",
    "apiSecret": "e%f253^gh"
  },
  "edge": {
    "zip": "chromium_addon.zip",
    "clientId": "aaaaaaa-aaaa-bbbb-cccc-dddddddddddd",
    "clientSecret": "ab#c4de6fg",
    "productId": "aaaaaaa-aaaa-bbbb-cccc-dddddddddddd",
    "accessTokenUrl": "https://login.microsoftonline.com/aaaaaaa-aaaa-bbbb-cccc-dddddddddddd/oauth2/v2.0/token",
    "notes": "This is a test submission"
  }
}

Once you got your json file, you will need to copy its content into a GitHub secret. You can do this by following the instructions on creating encrypted secrets for a repository. In this example, we will use the secret name BPP_KEYS.

Then, the action can be used as follows:

steps:
  - name: Browser Platform Publish
    uses: PlasmoHQ/bpp@v3
    with:
      keys: ${{ secrets.BPP_KEYS }}

Action Input Parameters (with)

The following parameters can be used to override the configuration in the keys file. Specifying options here will override those in the keys file.

  keys:
    required: true
    description: "A JSON string containing the keys to be used for the submission process. (This should be a secret)"
  artifact:
    alias: [zip, file]
    required: false
    description: "The extension zip artifact to be published on all stores."
  opera-file/chrome-file/firefox-file/edge-file:
    required: false
    description: "The file to be published to a specific store."
  notes:
    alias: [edge-notes]
    required: false
    description: "[Edge only] A release note cataloging changes."
  verbose:
    required: false
    description: "Print out more verbose logging."
  version-file:
    required: false
    description: "The path to a json file with a version field, default to package.json."

Custom input parameters example

steps:
  - name: Browser Platform Publish
    uses: PlasmoHQ/bpp@v3
    with:
      keys: ${{ secrets.BPP_KEYS }}
      chrome-file: "chrome/myext_chromium_${{ env.EXT_VERSION }}.zip"
      edge-file: "edge/myext_edge_${{ env.EXT_VERSION }}.zip"
      edge-notes: "This is a test submission"
      version-file: "src/manifest.json"
      verbose: true

Support

Join the Discord channel!

License

MIT โญ Plasmo Corp.

bpp's People

Contributors

araxeus avatar coldsauce avatar dependabot[bot] avatar drmikecrowe avatar louisgv avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bpp's Issues

Edge Workflow failed - cannot find publish button

Hi @louisgv,

After your contribution to Copy Guard, I tried the submit workflow, but it only managed to submit to the Chrome and Edge store.

It fails with this error:

a: waiting for selector `#publishButton` failed: timeout 30000ms exceeded
    at new d (/home/runner/work/_actions/plasmo-corp/bpp/v1/dist/index.js:36:35640)
    at waitForSelectorInPage (/home/runner/work/_actions/plasmo-corp/bpp/v1/dist/index.js:36:33752)
    at Object.A.queryOne.u.waitFor (/home/runner/work/_actions/plasmo-corp/bpp/v1/dist/index.js:[23](https://github.com/roedesh/copyguard/runs/5338858177?check_suite_focus=true#step:6:23):67036)
    at waitForSelector (/home/runner/work/_actions/plasmo-corp/bpp/v1/dist/index.js:36:31998)
    at A.waitForSelector (/home/runner/work/_actions/plasmo-corp/bpp/v1/dist/index.js:36:47436)
    at B.waitForSelector (/home/runner/work/_actions/plasmo-corp/bpp/v1/dist/index.js:36:99750)
    at /home/runner/work/_actions/plasmo-corp/bpp/v1/dist/index.js:169:9097
    at Generator.next (<anonymous>)
    at /home/runner/work/_actions/plasmo-corp/bpp/v1/dist/index.js:8:2[30](https://github.com/roedesh/copyguard/runs/5338858177?check_suite_focus=true#step:6:30)9
    at new Promise (<anonymous>)

I also get this server response error: Server response: Duplicate add-on ID found. (status: 400)

Firefox error

It seems mwu does not throw an error even if the request is 400. We need to catch these request status and throw them accordingly.

[BUG] Market client errors swallowed

What happened?

First, Plasmo is awesome and definitely making the Chrome extension dev experience better.

My extension was already in the Chrome Web Store, but I made some changes that required additional permissions. When I ran the bpp action, all I got in the output was:

๐Ÿ”ด ERROR  | Error: chrome: Step 2) Item "<redacted>": Response code 400 (Bad Request)

I tried the verbose option and setting chrome.verbose = true in the keys, to no avail.

I was able to fork the action and increase the detail of the error logging (which involved vendoring bms, as it actually swallows the useful information when it does getVerboseError).

Eventually I was able to see in the response body:

Publish condition not met: To publish your item, you must provide mandatory privacy information in the new Developer Dashboard: https://chrome.google.com/webstore/devconsole. Click on your item from the home page and enter this information on the Privacy practices tab.

Once I saw this it was easy to make the change in the web store and then the action was able to submit it successfully.

Could we get the 4xx responses from the extension stores displayed here? I think it will be very helpful for debugging issues.

I only tried Chrome though I have a feeling the issue exists for other stores.

If you want me to open this in bms instead I can, I think changes may be required in both. We could get away with only changes in bms if we put the response body into the error message though.

Which browsers are you seeing the problem on?

Chrome

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.

[BUG] firefox: duplicate add-on ID found

What happened?

Hello, I've been testing BPP in my open-source repository, and I was able to successfully build & publish my extension to the Chrome and Edge stores. However, in this failed workflow, Firefox throws a "duplicate add-on ID found" error. I intentionally leave the firefox.extId value blank in my keys.json, because my manifest.json contains the following:

"browser_specific_settings": {
  "gecko": {
    "id": "[email protected]"
  }
}

After double-checking the schema for the keys file, it says to check the Technical Details section of my addon listing, which displays:
image

Is this an error on my end? Should I manually include the extension id of [email protected] in the BPP keys.json, or would that be redundant?

Which browsers are you seeing the problem on?

Firefox

Relevant log output

Error: firefox: Step 1) Item ""[email protected]" (Halo Notification Service)": Duplicate add-on ID found.

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.

[FR] Integration with semantic-release

semantic release is a end to end release automation process which relies on proper semantic versioning to trigger a release whenever a use visible commit is pushed to a release branch.

It handles updating changelog, git tag, package.json/manifest.json and then via a chrome specific plugin I also use it to publish to chrome. It also publishes a release to Github and comments and labels PRs and issues.

I also publsh to Edge but much less frequently because it doesn't have a plugin (and until very recently had no API) and there are some rough edges with the chrome plugin as well.

I could fork the chrome plugin to make an edge plugin using your edge publishing package but thought I'd open an FR here in case there was interest given your recent work.

[BUG] SyntaxError: Unexpected end of JSON input with firefox and edge

What happened?

A bug happened! This is the error I am facing on my github actions. Please help https://github.com/libreom/predirect/actions/runs/7157655020/job/19488824749

Run PlasmoHQ/bpp@v[3](https://github.com/libreom/predirect/actions/runs/7157655020/job/19488824749#step:5:3)
  with:
    keys: ***
    chrome-file: chrome.zip
    firefox-file: firefox.xpi
    edge-file: chrome.zip
    edge-notes: Add redirection for new sites
    version-file: src/manifest.json
    verbose: true
๐ŸŸฃ Plasmo Browser Platform Publish v3
๐ŸŸก QUEUE  | Prepare for chrome submission
Info chrome: Step 1) Updating extension with ID aiillidfcgfckfhkpiakhkkpbkknagnp
๐ŸŸก QUEUE  | Prepare for firefox submission
๐ŸŸก QUEUE  | Prepare for edge submission
Error: ๐Ÿ”ด ERROR  | SyntaxError: Unexpected end of JSON input
Error: ๐Ÿ”ด ERROR  | SyntaxError: Unexpected end of JSON input
Error: ๐Ÿ”ด ERROR  | SyntaxError: Unexpected end of JSON input```

### Which browsers are you seeing the problem on?

Microsoft Edge, Firefox

### Relevant log output

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
- [X] I checked the [current issues](https://github.com/PlasmoHQ/bpp/issues?q=is%3Aopen+is%3Aissue+label%3Abug) for duplicate problems.

BUG | Firefox store upload not working

Ref:

After testing the firefox submission in another test extension, I found that the current puppeteer is a leaky abstraction - the mozilla webpage might have mutated over time, and thus the script is outdated.

I'm working on a solution that consume web-ext library from mozilla: https://github.com/mozilla/web-ext

This will be integrated into our fork of web-ext-deploy: https://github.com/plasmo-corp/web-ext-deploy

Which would provide the new firefox submission capability. The following are TODOS:

  • Update keys schema to use apikey and apiSecret for firefox store
  • Implement web-ext submission package: https://github.com/plasmo-corp/mwu
  • Integrate mwu into @plasmo-corp/web-ext-deploy
  • Integrate @plasmo-corp/web-ext-deploy into bpp

Accept edge notes field as a independent input to action

Since one purpose of the certification notes for edge is cataloging changes from previous publish it makes sense to allow setting it from an argument vs it being static as a Github secret.

It's possible that the secret could contain the static part or a template where the change notes get inserted.

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.


  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.