mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 11:37:02 +03:00
deploy firefox beta releases to github pages, enable updates
This commit is contained in:
63
.github/workflows/release.yml
vendored
63
.github/workflows/release.yml
vendored
@@ -106,7 +106,7 @@ jobs:
|
|||||||
|
|
||||||
# Firefox Beta
|
# Firefox Beta
|
||||||
- name: Create Firefox Beta artifacts
|
- name: Create Firefox Beta artifacts
|
||||||
run: npm run build:firefox -- --env stream=beta
|
run: npm run build:firefox -- --env stream=beta --env autoupdate
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: FirefoxExtensionBeta
|
name: FirefoxExtensionBeta
|
||||||
@@ -120,10 +120,8 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }}
|
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }}
|
||||||
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }}
|
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }}
|
||||||
- name: Install rename
|
|
||||||
run: sudo apt-get install rename
|
|
||||||
- name: Rename signed file
|
- name: Rename signed file
|
||||||
run: cd ./web-ext-artifacts ; rename 's/.*/FirefoxSignedInstaller.xpi/' *
|
run: mv ./web-ext-artifacts/* ./web-ext-artifacts/FirefoxSignedInstaller.xpi
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: FirefoxExtensionSigned.xpi
|
name: FirefoxExtensionSigned.xpi
|
||||||
@@ -137,3 +135,60 @@ jobs:
|
|||||||
path: ./web-ext-artifacts/FirefoxSignedInstaller.xpi
|
path: ./web-ext-artifacts/FirefoxSignedInstaller.xpi
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Prepare new github pages deployment
|
||||||
|
shell: python
|
||||||
|
run: |
|
||||||
|
from pathlib import Path
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
# config stuff
|
||||||
|
installer_name = "FirefoxSignedInstaller.xpi"
|
||||||
|
owner, repo_name = os.environ["GITHUB_REPOSITORY"].split("/")
|
||||||
|
owner = owner.lower()
|
||||||
|
|
||||||
|
# create the github paged dir
|
||||||
|
ghp_dir = Path("./github-pages")
|
||||||
|
ghp_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
# move in the installer
|
||||||
|
Path("./web-ext-artifacts", installer_name).rename(ghp_dir / installer_name)
|
||||||
|
|
||||||
|
# read manifest.json and extract parameters
|
||||||
|
with open("./dist/manifest.json") as f:
|
||||||
|
manifest = json.load(f)
|
||||||
|
current_version = manifest["version"]
|
||||||
|
ext_id = manifest["browser_specific_settings"]["gecko"]["id"]
|
||||||
|
|
||||||
|
# generate updates file
|
||||||
|
updates = {
|
||||||
|
"addons": {
|
||||||
|
ext_id: {
|
||||||
|
"updates": [
|
||||||
|
{
|
||||||
|
"version": current_version,
|
||||||
|
# param doesn't actually matter, it's just a cachebuster
|
||||||
|
"update_link": f"https://{owner}.github.io/{repo_name}/{installer_name}?v={current_version}",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
(ghp_dir / "updates.json").write_text(json.dumps(updates))
|
||||||
|
|
||||||
|
- name: Upload new github pages deployment
|
||||||
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
with:
|
||||||
|
path: ./github-pages
|
||||||
|
|
||||||
|
deploy-ghp:
|
||||||
|
name: Deploy to github pages
|
||||||
|
needs: build
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Deploy
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
||||||
|
|||||||
@@ -189,7 +189,8 @@ module.exports = env => {
|
|||||||
new BuildManifest({
|
new BuildManifest({
|
||||||
browser: env.browser,
|
browser: env.browser,
|
||||||
pretty: env.mode === "production",
|
pretty: env.mode === "production",
|
||||||
stream: env.stream
|
stream: env.stream,
|
||||||
|
autoupdate: env.autoupdate,
|
||||||
}),
|
}),
|
||||||
new configDiffPlugin()
|
new configDiffPlugin()
|
||||||
],
|
],
|
||||||
@@ -200,4 +201,4 @@ module.exports = env => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,10 +23,13 @@ const schema = {
|
|||||||
pretty: {
|
pretty: {
|
||||||
type: 'boolean'
|
type: 'boolean'
|
||||||
},
|
},
|
||||||
steam: {
|
stream: {
|
||||||
type: 'string'
|
type: 'string'
|
||||||
|
},
|
||||||
|
autoupdate: {
|
||||||
|
type: 'boolean',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class BuildManifest {
|
class BuildManifest {
|
||||||
@@ -62,6 +65,11 @@ class BuildManifest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.options.autoupdate === true && this.options.browser.toLowerCase() === "firefox") {
|
||||||
|
const [owner, repo_name] = process.env.GITHUB_REPOSITORY.split("/");
|
||||||
|
manifest.browser_specific_settings.gecko.update_url = `https://${owner.toLowerCase()}.github.io/${repo_name}/updates.json`;
|
||||||
|
}
|
||||||
|
|
||||||
let result = JSON.stringify(manifest);
|
let result = JSON.stringify(manifest);
|
||||||
if (this.options.pretty) result = JSON.stringify(manifest, null, 2);
|
if (this.options.pretty) result = JSON.stringify(manifest, null, 2);
|
||||||
|
|
||||||
@@ -86,4 +94,4 @@ function mergeObjects(object1, object2) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = BuildManifest;
|
module.exports = BuildManifest;
|
||||||
|
|||||||
Reference in New Issue
Block a user