Compare commits

..

No commits in common. "8315d49a58716e6746af0f6904c70383f1ca270b" and "8f5438fffd484d6906b0f1ddc6550287d6759eb0" have entirely different histories.

7 changed files with 21 additions and 155 deletions

View File

@ -39,35 +39,12 @@ domains such as `youtube.com` or `x.com`.
Manual “Send page”, selection, link and file actions are separate. They create Manual “Send page”, selection, link and file actions are separate. They create
Browser Inbox captures; they do not create a workspace or a journal entry. Browser Inbox captures; they do not create a workspace or a journal entry.
## Firefox download and updates ## Firefox Release
The signed XPI is published on the [GitHub Releases page](https://github.com/mirivlad/verstak-browser-extension/releases).
Download the Firefox asset named `verstak-firefox-<version>.xpi` from the latest
release and open it in Firefox to install it.
After the first public release, installed copies check GitHub Releases for
updates through the release's `updates.json` asset. During the alpha phase each
published release is the current update channel.
## Firefox release publishing
Firefox signing uses `web-ext` and AMO credentials from an env file. The script Firefox signing uses `web-ext` and AMO credentials from an env file. The script
requires `WEB_EXT_API_PROXY`; AMO upload and approval polling run through that requires `WEB_EXT_API_PROXY`; AMO upload and approval polling run through that
proxy. proxy.
Create the signed XPI and publish it, together with `updates.json`, as the
current GitHub Release:
```bash
VERSTAK_BROWSER_ENV=/path/to/.env npm run publish:firefox
```
The first invocation publishes tag `v2.0.2` and bootstraps the
`releases/latest/download/updates.json` endpoint. Re-running the command
replaces those two release assets for the same tag.
To sign and prepare release files locally without changing GitHub:
```bash ```bash
VERSTAK_BROWSER_ENV=/home/mirivlad/git/verstak/.env npm run release:firefox VERSTAK_BROWSER_ENV=/home/mirivlad/git/verstak/.env npm run release:firefox
``` ```
@ -77,9 +54,8 @@ Release output:
- `release/firefox/verstak-firefox-<version>.xpi` - `release/firefox/verstak-firefox-<version>.xpi`
- `release/firefox/updates.json` - `release/firefox/updates.json`
The XPI is signed as an unlisted/self-distributed Firefox extension; GitHub The XPI is signed as an unlisted/self-distributed Firefox extension. Build and
Releases distribute that signed file. Build and release artifacts are local release artifacts are local outputs and are not committed.
outputs and are not committed.
## Reproducible local package ## Reproducible local package

View File

@ -4,12 +4,12 @@
"version": "2.0.2", "version": "2.0.2",
"description": "Send pages, selections, links, and files to the local Verstak browser inbox.", "description": "Send pages, selections, links, and files to the local Verstak browser inbox.",
"author": "Verstak", "author": "Verstak",
"homepage_url": "https://github.com/mirivlad/verstak-browser-extension", "homepage_url": "https://git.mirv.top/verstak/verstak-browser-extension",
"browser_specific_settings": { "browser_specific_settings": {
"gecko": { "gecko": {
"id": "verstak-bridge@verstak.app", "id": "verstak-bridge@verstak.app",
"strict_min_version": "115.0", "strict_min_version": "115.0",
"update_url": "https://github.com/mirivlad/verstak-browser-extension/releases/latest/download/updates.json", "update_url": "https://mirv.top/verstak/firefox/updates.json",
"data_collection_permissions": { "data_collection_permissions": {
"required": ["none"] "required": ["none"]
} }

View File

@ -6,10 +6,9 @@
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"scripts": { "scripts": {
"build": "node scripts/build-extension.js", "build": "node scripts/build-extension.js",
"test": "node scripts/test-hostname.js && node scripts/test-activity-tracker.js && node scripts/test-protocol.js && node scripts/test-i18n.js && node scripts/test-popup-settings.js && node scripts/test-popup-catalog-fallback.js && node scripts/test-background-i18n.js && node scripts/test-firefox-github-release.js", "test": "node scripts/test-hostname.js && node scripts/test-activity-tracker.js && node scripts/test-protocol.js && node scripts/test-i18n.js && node scripts/test-popup-settings.js && node scripts/test-popup-catalog-fallback.js && node scripts/test-background-i18n.js",
"sign:firefox": "./scripts/sign-firefox-xpi.sh", "sign:firefox": "./scripts/sign-firefox-xpi.sh",
"release:firefox": "./scripts/release-firefox-xpi.sh", "release:firefox": "./scripts/release-firefox-xpi.sh",
"publish:firefox": "./scripts/publish-firefox-github-release.sh",
"release:package": "./scripts/package-release.sh" "release:package": "./scripts/package-release.sh"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,40 +0,0 @@
const fs = require('fs');
const REPOSITORY = 'mirivlad/verstak-browser-extension';
function releaseTag(version) {
return `v${version}`;
}
function releaseAssetURL(version, assetName) {
return `https://github.com/${REPOSITORY}/releases/download/${releaseTag(version)}/${assetName}`;
}
function updateManifest(addonID, version, assetName) {
return {
addons: {
[addonID]: {
updates: [{
version,
update_link: releaseAssetURL(version, assetName),
}],
},
},
};
}
function writeUpdates(addonID, version, assetName, outputPath) {
fs.writeFileSync(outputPath, `${JSON.stringify(updateManifest(addonID, version, assetName), null, 2)}\n`);
}
if (require.main === module) {
const [, , command, addonID, version, assetName, outputPath] = process.argv;
if (command !== 'write-updates' || !addonID || !version || !assetName || !outputPath) {
console.error('usage: node scripts/firefox-github-release.js write-updates <addon-id> <version> <asset-name> <output-path>');
process.exitCode = 2;
} else {
writeUpdates(addonID, version, assetName, outputPath);
}
}
module.exports = { REPOSITORY, releaseTag, releaseAssetURL, updateManifest, writeUpdates };

View File

@ -1,43 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR"
REPOSITORY="mirivlad/verstak-browser-extension"
SOURCE_DIR="${VERSTAK_FIREFOX_SOURCE_DIR:-dist/firefox}"
RELEASE_DIR="${VERSTAK_FIREFOX_RELEASE_DIR:-release/firefox}"
if ! command -v gh >/dev/null; then
echo "ERROR: gh CLI is required to publish a GitHub Release" >&2
exit 1
fi
gh auth status
./scripts/release-firefox-xpi.sh
VERSION="$(node -e "console.log(require('./${SOURCE_DIR}/manifest.json').version)")"
TAG="v${VERSION}"
XPI="$RELEASE_DIR/verstak-firefox-${VERSION}.xpi"
UPDATES="$RELEASE_DIR/updates.json"
for artifact in "$XPI" "$UPDATES"; do
if [[ ! -f "$artifact" ]]; then
echo "ERROR: release artifact not found: $artifact" >&2
exit 1
fi
done
if gh release view "$TAG" --repo "$REPOSITORY" >/dev/null 2>&1; then
gh release upload "$TAG" "$XPI" "$UPDATES" --repo "$REPOSITORY" --clobber
else
gh release create "$TAG" "$XPI" "$UPDATES" \
--repo "$REPOSITORY" \
--title "Verstak Browser Extension $VERSION" \
--generate-notes \
--latest \
--target "$(git rev-parse HEAD)"
fi
echo "GitHub release:"
gh release view "$TAG" --repo "$REPOSITORY" --json url --jq .url

View File

@ -32,6 +32,7 @@ load_env_file "$ENV_FILE"
SOURCE_DIR="${VERSTAK_FIREFOX_SOURCE_DIR:-dist/firefox}" SOURCE_DIR="${VERSTAK_FIREFOX_SOURCE_DIR:-dist/firefox}"
ARTIFACTS_DIR="${WEB_EXT_ARTIFACTS_DIR:-web-ext-artifacts}" ARTIFACTS_DIR="${WEB_EXT_ARTIFACTS_DIR:-web-ext-artifacts}"
RELEASE_DIR="${VERSTAK_FIREFOX_RELEASE_DIR:-release/firefox}" RELEASE_DIR="${VERSTAK_FIREFOX_RELEASE_DIR:-release/firefox}"
UPDATE_BASE_URL="${VERSTAK_FIREFOX_UPDATE_BASE_URL:-https://mirv.top/verstak/firefox}"
./scripts/sign-firefox-xpi.sh ./scripts/sign-firefox-xpi.sh
@ -53,8 +54,20 @@ mkdir -p "$RELEASE_DIR"
RELEASE_XPI="verstak-firefox-${VERSION}.xpi" RELEASE_XPI="verstak-firefox-${VERSION}.xpi"
cp "$SIGNED_XPI" "$RELEASE_DIR/$RELEASE_XPI" cp "$SIGNED_XPI" "$RELEASE_DIR/$RELEASE_XPI"
node scripts/firefox-github-release.js write-updates \ cat > "$RELEASE_DIR/updates.json" <<EOF
"$ADDON_ID" "$VERSION" "$RELEASE_XPI" "$RELEASE_DIR/updates.json" {
"addons": {
"${ADDON_ID}": {
"updates": [
{
"version": "${VERSION}",
"update_link": "${UPDATE_BASE_URL}/${RELEASE_XPI}"
}
]
}
}
}
EOF
echo "Firefox release artifacts:" echo "Firefox release artifacts:"
echo "$RELEASE_DIR/$RELEASE_XPI" echo "$RELEASE_DIR/$RELEASE_XPI"

View File

@ -1,39 +0,0 @@
#!/usr/bin/env node
const assert = require('assert');
const fs = require('fs');
const release = require('./firefox-github-release');
const version = '2.0.2';
const asset = 'verstak-firefox-2.0.2.xpi';
assert.equal(release.releaseTag(version), 'v2.0.2');
assert.equal(
release.releaseAssetURL(version, asset),
'https://github.com/mirivlad/verstak-browser-extension/releases/download/v2.0.2/verstak-firefox-2.0.2.xpi',
);
assert.deepEqual(release.updateManifest('verstak-bridge@verstak.app', version, asset), {
addons: {
'verstak-bridge@verstak.app': {
updates: [{
version: '2.0.2',
update_link: 'https://github.com/mirivlad/verstak-browser-extension/releases/download/v2.0.2/verstak-firefox-2.0.2.xpi',
}],
},
},
});
const firefoxManifest = require('../firefox/manifest.json');
assert.equal(firefoxManifest.homepage_url, 'https://github.com/mirivlad/verstak-browser-extension');
assert.equal(
firefoxManifest.browser_specific_settings.gecko.update_url,
'https://github.com/mirivlad/verstak-browser-extension/releases/latest/download/updates.json',
);
const publisher = fs.readFileSync('scripts/publish-firefox-github-release.sh', 'utf8');
assert.match(publisher, /gh auth status/);
assert.match(publisher, /gh release create/);
assert.match(publisher, /gh release upload/);
assert.match(publisher, /--clobber/);
assert.match(publisher, /--latest/);
console.log('Firefox GitHub release metadata tests passed');