Skip to content

Commit

Permalink
👷 Prepare for selfhost
Browse files Browse the repository at this point in the history
  • Loading branch information
WillsterJohnson committed Jul 7, 2023
1 parent 7acab8f commit e95ff2f
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 25 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/RELEASE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
build:
name: Publish binaries
name: Publish
runs-on: ubuntu-latest

steps:
Expand All @@ -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 }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ dist/**/*
!dist/**/*.html
node_modules
*.zip
*.xpi
20 changes: 12 additions & 8 deletions bumpVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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",
});
19 changes: 11 additions & 8 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"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": "[email protected]",
"strict_min_version": "109.0",
"update_url": "https://github.com/WillsterJohnson/keybr-plusplus/releases/latest/download/update.json"
}
}
}
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -28,4 +26,4 @@
"tslib": "^2.6.0",
"typescript": "^5.1.6"
}
}
}
12 changes: 12 additions & 0 deletions update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"addons": {
"[email protected]": {
"updates": [
{
"version": "0.1.0",
"update_link": "https://github.com/WillsterJohnson/keybr-plusplus/releases/latest/download/keybrpp.xpi"
}
]
}
}
}

0 comments on commit e95ff2f

Please sign in to comment.