diff --git a/README.md b/README.md index 25a6d4c..ac19f60 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ This project is not affiliated with archive.org or aria2. Use responsibly and re - Set environment secrets locally (do not commit): `AMO_JWT_ISSUER=... AMO_JWT_SECRET=...` - Run: `npm run release:sign` - Artifacts land in `releases//` -- Push (self-hosted): `npm run release:push` uploads the signed artifacts in `releases//` and prepares/uploads `releases/updates.json` automatically (deriving the `update_link` from the manifest’s `applications.gecko.update_url`). +- Push (self-hosted): `npm run release:push` uploads the signed artifacts in `releases//` and prepares/uploads `releases/updates.json` automatically (deriving the `update_link` from the manifest’s `applications.gecko.update_url`). It also uploads a stable alias `archive-org-link-grabber-latest.xpi` that always points to the most recent XPI. - Ensure FTP env vars are set (see `.env.example`). Notes: Keep AMO secrets local (see `.env.example`). CI is optional. You can tag releases with `git tag vX.Y.Z` and push tags if desired. diff --git a/scripts/release-push.js b/scripts/release-push.js index e00d43c..f45c752 100644 --- a/scripts/release-push.js +++ b/scripts/release-push.js @@ -174,6 +174,25 @@ for (const file of files) { run(cmd, [user, pass]); } +// Upload a copy of the latest XPI under a stable filename for static linking +try { + const latestAlias = 'archive-org-link-grabber-latest.xpi'; + const localLatestSrc = path.join(artifactsDir, chosenXpi); + const latestUrl = `${baseUrl}/${latestAlias}`; + console.log(`Uploading latest alias ${latestAlias} -> ${chosenXpi}`); + const latestCmd = [ + 'curl', + '--fail', + '--ftp-create-dirs', + `--user`, `${user}:${pass}`, + '--upload-file', JSON.stringify(localLatestSrc), + JSON.stringify(latestUrl), + ].join(' '); + run(latestCmd, [user, pass]); +} catch (e) { + console.warn('Warning: Failed to upload latest alias:', e.message); +} + // Also upload updates.json (self-hosted updates manifest) alongside artifacts const updatesPath = path.join(root, 'releases', 'updates.json'); if (fs.existsSync(updatesPath)) {