Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release metadata #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
after: true
no-useless-escape: off
no-prototype-builtins: off
overrides:
- files: "*.mjs"
parserOptions:
sourceType: module
globals:
BigInt: readonly
_: readonly
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/update-release-metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Update Release Metadata

on:
workflow_dispatch:
inputs:
newVersion:
description: version override
type: string
required: false

jobs:
create-update-pr:
name: Create update PR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Update release metadata
run: node dev/update_release_metadata.mjs ${{ inputs.newVersion || '' }}

- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
title: Update release metadata
commit-message: update release metadata
branch: update-release-metadata
body: |
Updates the extension version in metadata files, triggering Firefox autoupdate and the "Please update XKit!" in-extension notification.

Remember to confirm that the referenced version is released on Github, the .xpi file link works, and the Chrome web store has the referenced version available before merging this.
4 changes: 2 additions & 2 deletions Extensions/dist/page/FirefoxUpdate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"@new-xkit": {
"updates": [
{
"version": "7.9.2",
"update_link": "https://github.com/new-xkit/XKit/releases/download/v7.9.2/new_xkit-7.9.2.xpi"
"version": "7.12.15",
"update_link": "https://github.com/new-xkit/XKit/releases/download/v7.12.15/new_xkit-7.12.15.xpi"
}
]
}
Expand Down
6 changes: 3 additions & 3 deletions Extensions/dist/page/FirefoxUpdate.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!-- Each li is a different version of the same add-on -->
<RDF:li>
<RDF:Description>
<em:version>7.9.2</em:version> <!-- This is the version number of the add-on -->
<em:version>7.12.15</em:version> <!-- This is the version number of the add-on -->

<!-- One targetApplication for each application the add-on is compatible with -->
<em:targetApplication>
Expand All @@ -22,7 +22,7 @@
<em:maxVersion>*</em:maxVersion>

<!-- This is where this version of the add-on will be downloaded from -->
<em:updateLink>https://github.com/new-xkit/XKit/releases/download/v7.9.2/new_xkit-7.9.2.xpi</em:updateLink>
<em:updateLink>https://github.com/new-xkit/XKit/releases/download/v7.12.15/new_xkit-7.12.15.xpi</em:updateLink>

<!-- A page describing what is new in this updated version -->
<!-- <em:updateInfoURL></em:updateInfoURL> -->
Expand All @@ -37,7 +37,7 @@
<em:maxVersion>*</em:maxVersion>

<!-- This is where this version of the add-on will be downloaded from -->
<em:updateLink>https://github.com/new-xkit/XKit/releases/download/v7.9.2/new_xkit-7.9.2.xpi</em:updateLink>
<em:updateLink>https://github.com/new-xkit/XKit/releases/download/v7.12.15/new_xkit-7.12.15.xpi</em:updateLink>

<!-- A page describing what is new in this updated version -->
<!-- <em:updateInfoURL></em:updateInfoURL> -->
Expand Down
2 changes: 1 addition & 1 deletion Extensions/dist/page/framework_version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"server":"up","frameworks":[{"name":"firefox","version":"7.9.2"},{"name":"chrome","version":"7.9.2"},{"name":"safari","version":"7.7.3"}]}
{"server":"up","frameworks":[{"name":"firefox","version":"7.12.15"},{"name":"chrome","version":"7.12.15"},{"name":"safari","version":"7.7.3"}]}
18 changes: 18 additions & 0 deletions dev/update_release_metadata.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import fs from "node:fs";
import process from "node:process";

const newVersion = process.argv[2] || JSON.parse(fs.readFileSync("manifest.json", "utf8")).version;

const data = [
"Extensions/dist/page/FirefoxUpdate.json",
"Extensions/dist/page/FirefoxUpdate.rdf",
"Extensions/dist/page/framework_version.json",
].map(filePath => ({ filePath, contents: fs.readFileSync(filePath, "utf8") }));

const oldVersion = /7\.\d{1,2}.\d{1,2}/.exec(data[0].contents)[0];

console.log(`replacing ${oldVersion} with ${newVersion}`);

data.forEach(({ filePath, contents }) => {
fs.writeFileSync(filePath, contents.replaceAll(oldVersion, newVersion), { flag: "w+" });
});
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"name": "New XKit",
"author": "New XKit Team",
"permissions": ["storage", "unlimitedStorage", "*://*.tumblr.com/*", "https://new-xkit.github.io/XKit/*", "https://cloud.new-xkit.com/*" ],
"version": "7.9.2",
"version": "7.12.15",
"web_accessible_resources": [ "manifest.json", "editor.js" ],
"applications": {
"gecko": {
Expand Down