Automatic extension publishing (#453)
parent
0c030a3a27
commit
399305fd8a
@ -0,0 +1,60 @@
|
||||
name: Release Browser Extension
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
jobs:
|
||||
Publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: check that tag matches package.json version
|
||||
run: |
|
||||
pkg_version="$(jq -r .version < package.json)"
|
||||
if [[ "${{ github.ref_name }}" != "$pkg_version" ]]; then
|
||||
echo "Tag ${{ github.ref_name }} does not match package.json version $pkg_version" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- uses: pnpm/action-setup@v2 # Install pnpm using packageManager key in package.json
|
||||
|
||||
- name: Use Node.js 19
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 19
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build web
|
||||
run: pnpm buildWeb --standalone
|
||||
|
||||
- name: Publish extension
|
||||
run: |
|
||||
cd dist/extension-unpacked
|
||||
|
||||
# Do not fail so that even if chrome fails, firefox gets a shot. But also store exit code to fail workflow later
|
||||
EXIT_CODE=0
|
||||
|
||||
# Chrome
|
||||
pnpx chrome-webstore-upload-cli@2.1.0 upload --auto-publish || EXIT_CODE=$?
|
||||
|
||||
# Firefox
|
||||
pnpx web-ext-submit@7.4.0
|
||||
|
||||
exit $EXIT_CODE
|
||||
env:
|
||||
# Chrome
|
||||
EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
|
||||
CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
|
||||
CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
|
||||
REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
|
||||
|
||||
# Firefox
|
||||
WEB_EXT_API_KEY: ${{ secrets.WEBEXT_USER }}
|
||||
WEB_EXT_API_SECRET: ${{ secrets.WEBEXT_SECRET }}
|
||||
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Vencord, a modification for Discord's desktop app
|
||||
* Copyright (c) 2022 Linnea Gräf
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
function setContentTypeOnStylesheets(details) {
|
||||
if (details.type === "stylesheet") {
|
||||
details.responseHeaders = details.responseHeaders.filter(it => it.name.toLowerCase() !== 'content-type');
|
||||
details.responseHeaders.push({ name: "Content-Type", value: "text/css" });
|
||||
}
|
||||
return { responseHeaders: details.responseHeaders };
|
||||
}
|
||||
|
||||
var cspHeaders = [
|
||||
"content-security-policy",
|
||||
"content-security-policy-report-only",
|
||||
];
|
||||
|
||||
function removeCSPHeaders(details) {
|
||||
return {
|
||||
responseHeaders: details.responseHeaders.filter(header =>
|
||||
!cspHeaders.includes(header.name.toLowerCase()))
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
browser.webRequest.onHeadersReceived.addListener(
|
||||
setContentTypeOnStylesheets, { urls: ["https://raw.githubusercontent.com/*"] }, ["blocking", "responseHeaders"]
|
||||
);
|
||||
|
||||
browser.webRequest.onHeadersReceived.addListener(
|
||||
removeCSPHeaders, { urls: ["https://raw.githubusercontent.com/*", "*://*.discord.com/*"] }, ["blocking", "responseHeaders"]
|
||||
);
|
After Width: | Height: | Size: 21 KiB |
@ -1,25 +0,0 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Vencord Web",
|
||||
"description": "The Vencord Client Mod for Discord Web.",
|
||||
"version": "1.0.0",
|
||||
"author": "Vendicated",
|
||||
"homepage_url": "https://github.com/Vendicated/Vencord",
|
||||
"permissions": [
|
||||
"webRequest",
|
||||
"webRequestBlocking",
|
||||
"*://*.discord.com/*",
|
||||
"https://raw.githubusercontent.com/*"
|
||||
],
|
||||
"content_scripts": [
|
||||
{
|
||||
"run_at": "document_start",
|
||||
"matches": ["*://*.discord.com/*"],
|
||||
"js": ["content.js"]
|
||||
}
|
||||
],
|
||||
"web_accessible_resources": ["dist/Vencord.js", "dist/Vencord.css"],
|
||||
"background": {
|
||||
"scripts": ["background.js"]
|
||||
}
|
||||
}
|
Loading…
Reference in new issue