Skip to content

Commit

Permalink
v1.3.0 (#15)
Browse files Browse the repository at this point in the history
* Some quick update to the extension schema

* Update some readme

* v1.3.0 - swap to mozilla sign library, use apiKey and apiSecret for mozilla

* Add error handling (#14)

* Add some error handling

* Update boolean expression

* Throw error instead

Co-authored-by: Stefan Aleksic <[email protected]>
Co-authored-by: Louis <[email protected]>

Co-authored-by: Stefan Aleksic <[email protected]>
Co-authored-by: Stefan Aleksic <[email protected]>
  • Loading branch information
3 people authored Feb 21, 2022
1 parent 96085e4 commit dcae49d
Show file tree
Hide file tree
Showing 10 changed files with 838 additions and 203 deletions.
19 changes: 19 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @type {import('prettier').Options}
*/
module.exports = {
printWidth: 80,
tabWidth: 2,
useTabs: false,
semi: false,
singleQuote: false,
trailingComma: "none",
bracketSpacing: true,
bracketSameLine: true,

plugins: [require.resolve("@trivago/prettier-plugin-sort-imports")],

importOrder: ["^~(.*)$", "^[./]"],
importOrderSeparation: true,
importOrderSortSpecifiers: true
}
10 changes: 0 additions & 10 deletions .prettierrc.json

This file was deleted.

31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,42 @@

# Browser Plugin Publisher

Use this action to publish your browser plugin to any browser plugin marketplace.
Use this action to publish your browser plugin to every browser plugin marketplace.

## Usage

First, create a `keys.json` in your favorite text editor (preferably one with [json-schema](https://json-schema.org/) support):

```json
{
"$schema": "https://raw.githubusercontent.com/plasmo-corp/bpp/main/keys.schema.json"
"$schema": "https://raw.githubusercontent.com/plasmo-corp/bpp/v1/keys.schema.json"
}
```

A sample template is provided in [`key.template.json`](./keys.template.json), and the JSON schema is in [`keys.schema.json`](./keys.schema.json). If your editor supports [json-schema](https://json-schema.org/), it should give you intellisense/autocompletion while working on the keys.
A sample template is provided in [`keys.template.json`](./keys.template.json), and the JSON schema is in [`keys.schema.json`](./keys.schema.json). If your editor supports [json-schema](https://json-schema.org/), it should give you intellisense/autocompletion while working on the keys.

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

Copy the content of your `keys.json` into a github secret with the name `BPP_KEYS`. Then, the action can be used as follows:

```yaml
steps:
- uses: plasmo-corp/bpp@v1
- name: Browser Plugin Publish
uses: plasmo-corp/bpp@v1
with:
keys: ${{ secrets.BPP_KEYS }}
```
**NOTE**: If you're publishing to Opera or Edge, you will need to setup chromium for puppeteer before running `bpp`. In v2, we will either deprecate puppeteer approach altogether (since it's quite a leaky abstraction), or have an option for bpp to download and setup the browser for you.

```yaml
steps:
- name: Setup Chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- name: Browser Plugin Publish
uses: plasmo-corp/bpp@v1
with:
keys: ${{ secrets.BPP_KEYS }}
```
Expand All @@ -33,7 +48,12 @@ steps:

```yaml
steps:
- uses: plasmo-corp/bpp@v1
- name: Setup Chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- name: Browser Plugin Publish
uses: plasmo-corp/bpp@v1
with:
artifact: build/artifact.zip
keys: ${{ secrets.BPP_KEYS }}
Expand All @@ -45,3 +65,4 @@ This works if you're only targeting chrome and edge for example.

- [web-ext-deploy](https://github.com/avi12/web-ext-deploy) by [avi12](https://github.com/avi12)
- [chrome-webstore-upload-cli](https://github.com/fregante/chrome-webstore-upload-cli) by [fregante](https://github.com/fregante)
- [web-ext](https://github.com/mozilla/web-ext) by [mozilla](https://github.com/mozilla)
2 changes: 1 addition & 1 deletion __tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test } from "@jest/globals"
import { execFileSync, ExecFileSyncOptions } from "child_process"
import { ExecFileSyncOptions, execFileSync } from "child_process"
import { readFile } from "fs/promises"
import { join } from "path"
import { cwd, env, execPath } from "process"
Expand Down
314 changes: 248 additions & 66 deletions dist/index.js

Large diffs are not rendered by default.

26 changes: 10 additions & 16 deletions keys.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,25 @@
"Firefox": {
"type": "object",
"additionalProperties": false,
"description": "For API Key and https://addons.mozilla.org/en-US/developers/addon/api/key/",
"properties": {
"extId": {
"apiKey": {
"type": "string",
"description": "Get it from https://addons.mozilla.org/addon/EXT_ID"
"description": "The JWT issuer, from https://addons.mozilla.org/en-US/developers/addon/api/key/"
},
"sessionid": {
"apiSecret": {
"type": "string",
"description": "npx web-ext-deploy --get-cookies=firefox"
},
"zip": {
"type": "string"
},
"zipSource": {
"type": "string"
"description": "The JWT secret, from https://addons.mozilla.org/en-US/developers/addon/api/key/"
},
"changelog": {
"extId": {
"type": "string",
"description": "Provide changelog for the Firefox users"
"description": "Get it from https://addons.mozilla.org/addon/EXT_ID. If it is embedded in your manifest under gecko.id, omit this property."
},
"devChangelog": {
"type": "string",
"description": "Provide changelog for the Firefox Add-ons reviewers"
"zip": {
"type": "string"
}
},
"required": ["extId", "sessionid"]
"required": ["apiKey", "apiSecret"]
},
"Edge": {
"type": "object",
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@plasmo/bpp",
"version": "1.2.0",
"version": "1.3.0",
"private": true,
"description": "Browser Plugin Publisher",
"main": "lib/main.js",
Expand Down Expand Up @@ -29,10 +29,11 @@
"license": "ISC",
"dependencies": {
"@actions/core": "1.6.0",
"@plasmo-corp/web-ext-deploy": "1.3.1"
"@plasmo-corp/bms": "0.0.1"
},
"devDependencies": {
"@jest/globals": "27.5.1",
"@trivago/prettier-plugin-sort-imports": "^3.2.0",
"@types/node": "17.0.18",
"@typescript-eslint/eslint-plugin": "5.12.0",
"@typescript-eslint/parser": "5.12.0",
Expand Down
Loading

0 comments on commit dcae49d

Please sign in to comment.