forked from Tylian/XKit
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d5f273
commit 9d175f6
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
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/* | ||
cache: npm | ||
|
||
- 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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+" }); | ||
}); |