Skip to content

Commit 9046be7

Browse files
committed
Rewrite publish workflow
1 parent 31e03e3 commit 9046be7

File tree

4 files changed

+105
-18
lines changed

4 files changed

+105
-18
lines changed

.github/workflows/main.yml

+46-17
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,36 @@ 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
25-
echo $VERSION >> ./output/version.txt
22+
mkdir -p output
23+
mkdir -p output/chrome
24+
mkdir -p output/firefox
25+
VERSION=$(echo -n $(cat ./manifests/version.txt))
26+
echo $VERSION
2627
27-
- name: Upload output as artifact
28+
- name: Zip the Chrome extension
29+
run: |
30+
VERSION=$(echo -n $(cat ./manifests/version.txt))
31+
cp ./app/* ./output/chrome -r
32+
cp ./manifests/manifest-chrome.json ./output/chrome/manifest.json
33+
jq --arg version "$VERSION" '.version = $version' ./output/chrome/manifest.json > ./output/chrome/manifest.json.tmp && mv ./output/chrome/manifest.json.tmp ./output/chrome/manifest.json
34+
zip -r ./output/ShaderToy-Chrome-Plugin-$VERSION.zip ./output/chrome
35+
36+
- name: Zip the Firefox extension
37+
env:
38+
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXT_ID }}
39+
run: |
40+
VERSION=$(echo -n $(cat ./manifests/version.txt))
41+
cp ./app/* ./output/firefox -r
42+
cp ./manifests/manifest-firefox.json ./output/firefox/manifest.json
43+
jq --arg id "$FIREFOX_EXT_ID" '.browser_specific_settings.gecko.id = $id' ./output/firefox/manifest.json > ./output/firefox/manifest.json.tmp && mv ./output/firefox/manifest.json.tmp ./output/firefox/manifest.json
44+
jq --arg version "$VERSION" '.version = $version' ./output/firefox/manifest.json > ./output/firefox/manifest.json.tmp && mv ./output/firefox/manifest.json.tmp ./output/firefox/manifest.json
45+
zip -r ./output/ShaderToy-Firefox-Plugin-$VERSION.zip ./output/firefox
46+
47+
- name: Upload output as artifacts
2848
uses: actions/upload-artifact@v4
2949
with:
3050
name: output
@@ -41,17 +61,25 @@ jobs:
4161

4262
- name: Install Dependencies for Publishing
4363
run: |
44-
npm install -g chrome-webstore-upload-cli
64+
npm install --save-dev publish-browser-extension
4565
4666
- name: Upload & Publish Extension to Chrome Store
67+
env:
68+
CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
69+
CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
70+
CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
71+
CHROME_EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
72+
CHROME_PUBLISH_TARGET: trustedTesters
73+
CHROME_SKIP_SUBMIT_REVIEW: true
74+
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXT_ID }}
75+
FIREFOX_JWT_ISSUER: ${{ secrets.FIREFOX_JWT_ISSUER }}
76+
FIREFOX_JWT_SECRET: ${{ secrets.FIREFOX_JWT_SECRET }}
77+
4778
run: |
48-
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
79+
VERSION=$(echo -n $(cat ./manifests/version.txt))
80+
npx publish-extension \
81+
--chrome-zip ./output/ShaderToy-Chrome-Plugin-$VERSION.zip \
82+
--firefox-zip ./output/ShaderToy-Firefox-Plugin-$VERSION.zip
5583
5684
release:
5785
runs-on: self-hosted
@@ -64,5 +92,6 @@ jobs:
6492

6593
- name: Publish Release on GitHub
6694
run: |
67-
VERSION=$(cat ./output/version.txt)
68-
gh release create $VERSION ./output/ShaderToy-Chrome-Plugin-$VERSION.zip --title "$VERSION" --notes "Release of version $VERSION"
95+
VERSION=$(echo -n $(cat ./manifests/version.txt))
96+
gh release create $VERSION ./output/ShaderToy-Chrome-Plugin-$VERSION.zip ./output/ShaderToy-Firefox-Plugin-$VERSION.zip --title "$VERSION" --notes "Release of version $VERSION (Chrome)"
97+

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)