diff --git a/.github/workflows/RELEASE.yml b/.github/workflows/RELEASE.yml index b8673da..4a70481 100644 --- a/.github/workflows/RELEASE.yml +++ b/.github/workflows/RELEASE.yml @@ -6,7 +6,7 @@ on: jobs: build: - name: Publish binaries + name: Publish runs-on: ubuntu-latest steps: @@ -30,10 +30,18 @@ jobs: - name: Build run: pnpm dist - - name: Upload binaries to release + - name: Upload XPI to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: keybrpp.zip - asset_name: keybrpp-$tag.zip + file: keybrpp.xpi + asset_name: keybrpp.xpi + tag: ${{ github.event.release.tag_name }} + + - name: Upload update.json to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: update.json + asset_name: update.json tag: ${{ github.event.release.tag_name }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index b23781e..a6888ca 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ dist/**/* !dist/**/*.html node_modules *.zip +*.xpi diff --git a/bumpVersion.js b/bumpVersion.js index 776951f..c04d1ef 100644 --- a/bumpVersion.js +++ b/bumpVersion.js @@ -4,10 +4,10 @@ const args = process.argv.slice(2); const bumpType = args[0]; -const packageJson = JSON.parse(fs.readFileSync("./package.json", "utf8")); -const packageJsonVersion = packageJson.version; +const manifestJson = JSON.parse(fs.readFileSync("./manifest.json", "utf8")); +const manifestJsonVersion = manifestJson.version; -const [major, minor, patch] = packageJsonVersion.split("."); +const [major, minor, patch] = manifestJsonVersion.split("."); let newVersion; @@ -25,10 +25,14 @@ switch (bumpType) { throw new Error("Invalid bump type"); } -packageJson.version = newVersion; - -fs.writeFileSync("./package.json", JSON.stringify(packageJson, null, 2)); - -const manifestJson = JSON.parse(fs.readFileSync("./manifest.json", "utf8")); manifestJson.version = newVersion; + fs.writeFileSync("./manifest.json", JSON.stringify(manifestJson, null, 2)); + +const updateJson = JSON.parse(fs.readFileSync("./update.json", "utf8")); +const addonKey = Object.keys(updateJson.addons)[0]; +updateJson.addons[addonKey].updates.push({ + version: newVersion, + update_link: + "https://github.com/WillsterJohnson/keybr-plusplus/releases/latest/download/keybrpp.xpi", +}); \ No newline at end of file diff --git a/manifest.json b/manifest.json index b9beded..d188943 100644 --- a/manifest.json +++ b/manifest.json @@ -2,18 +2,21 @@ "$schema": "https://json.schemastore.org/chrome-manifest", "manifest_version": 3, "name": "KEYBR++", + "version": "0.1.0", "description": "Make https://www.keybr.com/ just that little bit better.", - "version": "0.1.1", - "browser_specific_settings": { - "gecko": { - "id": "keybrpluplus@willsterjohnson.com", - "strict_min_version": "100.0" - } - }, + "homepage_url": "https://github.com/WillsterJohnson/keybr-plusplus", "content_scripts": [ { "matches": ["https://www.keybr.com/*"], "js": ["dist/contentscript.js"] } - ] + ], + "update_url": "https://github.com/WillsterJohnson/keybr-plusplus/releases/latest/download/update.json", + "browser_specific_settings": { + "gecko": { + "id": "keybr-plusplus@willsterjohnson.com", + "strict_min_version": "109.0", + "update_url": "https://github.com/WillsterJohnson/keybr-plusplus/releases/latest/download/update.json" + } + } } diff --git a/package.json b/package.json index 43ad193..2314326 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,11 @@ { - "name": "keybr++", "author": "Will 'WillsterJohnson' Johnson", - "version": "0.1.1", - "description": "Make https://www.keybr.com/ just that little bit better.", + "private": true, "license": "GPL-3.0", "type": "module", "scripts": { "build": "rollup --config rollup.config.ts --configPlugin typescript", - "zip": "zip -r keybrpp.zip manifest.json LICENSE.txt dist/", + "zip": "zip -r keybrpp.xpi manifest.json LICENSE.txt dist/", "dist": "pnpm build && pnpm zip", "dev": "rollup --config rollup.config.ts --configPlugin typescript --watch", "bump": "node bumpVersion.js" @@ -28,4 +26,4 @@ "tslib": "^2.6.0", "typescript": "^5.1.6" } -} \ No newline at end of file +} diff --git a/update.json b/update.json new file mode 100644 index 0000000..2221716 --- /dev/null +++ b/update.json @@ -0,0 +1,12 @@ +{ + "addons": { + "keybr-plusplus@willsterjohnson.com": { + "updates": [ + { + "version": "0.1.0", + "update_link": "https://github.com/WillsterJohnson/keybr-plusplus/releases/latest/download/keybrpp.xpi" + } + ] + } + } +}