Skip to content

Commit 1814bc0

Browse files
committed
Rewrite publish workflow
1 parent 31e03e3 commit 1814bc0

File tree

4 files changed

+98
-15
lines changed

4 files changed

+98
-15
lines changed

.github/workflows/main.yml

+39-14
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,33 @@ jobs:
1515

1616
- name: Cleanup
1717
run: |
18-
rm output -rf
18+
rm -rf output
1919
20-
- name: Zip the extension
20+
- name: Prepare output directory
2121
run: |
22-
mkdir output
23-
VERSION=$(jq -r '.version' ./app/manifest.json)
24-
zip -r ./output/ShaderToy-Chrome-Plugin-$VERSION.zip ./app
22+
mkdir -p output
23+
VERSION=$(cat ./manifests/version.txt)
24+
echo $VERSION
25+
26+
- name: Zip the Chrome extension
27+
run: |
28+
cp ./app/* ./output/ -r
29+
cp ./manifest/manifest-chrome.json ./output/manifest.json
30+
jq --arg version "$VERSION" '.version = $version' ./output/manifest.json > ./output/manifest.json.tmp && mv ./output/manifest.json.tmp ./output/manifest.json
31+
zip -r ./output/ShaderToy-Chrome-Plugin-$VERSION.zip ./output
2532
echo $VERSION >> ./output/version.txt
2633
27-
- name: Upload output as artifact
34+
- name: Zip the Firefox extension
35+
env:
36+
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }}
37+
run: |
38+
cp ./app/* ./output/ -r
39+
cp ./manifest/manifest-firefox.json ./output/manifest.json
40+
jq --arg id "$FIREFOX_EXT_ID" '.browser_specific_settings.gecko.id = $id' ./output/manifest.json > ./output/manifest.json.tmp && mv ./output/manifest.json.tmp ./output/manifest.json
41+
jq --arg version "$VERSION" '.version = $version' ./output/manifest.json > ./output/manifest.json.tmp && mv ./output/manifest.json.tmp ./output/manifest.json
42+
zip -r ./output/ShaderToy-Firefox-Plugin-$VERSION.zip ./output
43+
44+
- name: Upload output as artifacts
2845
uses: actions/upload-artifact@v4
2946
with:
3047
name: output
@@ -41,17 +58,25 @@ jobs:
4158

4259
- name: Install Dependencies for Publishing
4360
run: |
44-
npm install -g chrome-webstore-upload-cli
61+
npm install --save-dev publish-browser-extension
4562
4663
- name: Upload & Publish Extension to Chrome Store
64+
env:
65+
CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
66+
CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
67+
CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
68+
CHROME_EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
69+
CHROME_PUBLISH_TARGET: trustedTesters
70+
CHROME_SKIP_SUBMIT_REVIEW: true
71+
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }}
72+
FIREFOX_JWT_ISSUER: ${{ secrets.FIREFOX_JWT_ISSUER }}
73+
FIREFOX_JWT_SECRET: ${{ secrets.FIREFOX_JWT_SECRET }}
74+
4775
run: |
4876
VERSION=$(cat ./output/version.txt)
49-
chrome-webstore-upload upload \\
50-
--source ./output/ShaderToy-Chrome-Plugin-$VERSION.zip \\
51-
--extension-id $APP_ID \\
52-
--client-id $CLIENT_ID \\
53-
--client-secret $CLIENT_SECRET \\
54-
--refresh-token $REFRESH_TOKEN
77+
npx publish-extension \
78+
--chrome-zip ./output/ShaderToy-Chrome-Plugin-$VERSION.zip \
79+
--firefox-zip ./output/ShaderToy-Firefox-Plugin-$VERSION.zip
5580
5681
release:
5782
runs-on: self-hosted
@@ -65,4 +90,4 @@ jobs:
6590
- name: Publish Release on GitHub
6691
run: |
6792
VERSION=$(cat ./output/version.txt)
68-
gh release create $VERSION ./output/ShaderToy-Chrome-Plugin-$VERSION.zip --title "$VERSION" --notes "Release of version $VERSION"
93+
gh release create $VERSION ./output/ShaderToy-Chrome-Plugin-$VERSION.zip --title "$VERSION" --notes "Release of version $VERSION (chrome)"

app/manifest.json manifests/manifest-chrome.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "Shadertoy unofficial plugin.",
4-
"version": "0.14.271",
4+
"version": "",
55
"description": "Shadertoy.com unofficial plugin.",
66
"homepage_url": "https://github.com/patuwwy/ShaderToy-Chrome-Plugin",
77
"background": {

manifests/manifest-firefox.json

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"manifest_version": 3,
3+
"name": "Shadertoy unofficial plugin.",
4+
"version": "",
5+
"description": "Shadertoy.com unofficial plugin.",
6+
"homepage_url": "https://github.com/patuwwy/ShaderToy-Chrome-Plugin",
7+
"browser_specific_settings": {
8+
"gecko": {
9+
"id": ""
10+
}
11+
},
12+
"background": {
13+
"scripts": [
14+
"background.js"
15+
]
16+
},
17+
"host_permissions": ["https://www.shadertoy.com/*"],
18+
"icons": {
19+
"128": "assets/icon_active_128.png"
20+
},
21+
"action": {
22+
"default_title": "ShaderToy plugin",
23+
"default_icon": "assets/icon_active_128.png",
24+
"default_popup": "popup.html"
25+
},
26+
"content_scripts": [
27+
{
28+
"matches": ["https://www.shadertoy.com/*"],
29+
"exclude_matches": ["https://www.shadertoy.com/signin"],
30+
"js": ["contentscript.js"],
31+
"css": ["style.css"],
32+
"run_at": "document_end"
33+
}
34+
],
35+
"web_accessible_resources": [
36+
{
37+
"resources": [
38+
"popup.js",
39+
"shadertoy-plugin.js",
40+
"shadertoy-plugin-common.js",
41+
"add-ons/shadertoy-plugin-codemirror.js",
42+
"add-ons/shadertoy-plugin-parameters.js",
43+
"add-ons/shadertoy-plugin-bbcode.js",
44+
"add-ons/monaco/loader.min.js",
45+
"add-ons/monaco/min/vs/editor/editor.main.js",
46+
"add-ons/monaco/min/vs/editor/editor.main.css",
47+
"add-ons/monaco/min/vs/base/worker/workerMain.js",
48+
"shadertoy-plugin-profile.js",
49+
"shadertoy-plugin-home.js",
50+
"scripts/jszip-3.1.5.js",
51+
"scripts/node-sanitize-filename.js"
52+
],
53+
"matches": ["https://www.shadertoy.com/*"]
54+
}
55+
]
56+
57+
}

manifests/version.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.14.273

0 commit comments

Comments
 (0)