-
-
Notifications
You must be signed in to change notification settings - Fork 29
71 lines (61 loc) · 1.91 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: CI/CD for Chrome Extension
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cleanup
run: |
rm output -rf
- name: Zip the extension
run: |
mkdir output
VERSION=$(jq -r '.version' ./app/manifest.json)
zip -r ./output/ShaderToy-Chrome-Plugin-$VERSION.zip ./app
echo $VERSION >> ./output/version.txt
- name: Upload output as artifact
uses: actions/upload-artifact@v4
with:
name: output
path: output/
publish:
runs-on: self-hosted
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download output artifact
uses: actions/download-artifact@v4
with:
name: output
- name: Install Dependencies for Publishing
run: |
npm install -g chrome-webstore-upload-cli
- name: Upload & Publish Extension to Chrome Store
run: |
VERSION=$(cat ./output/version.txt)
chrome-webstore-upload upload \\
--source ./output/ShaderToy-Chrome-Plugin-$VERSION.zip \\
--extension-id $APP_ID \\
--client-id $CLIENT_ID \\
--client-secret $CLIENT_SECRET \\
--refresh-token $REFRESH_TOKEN
release:
runs-on: self-hosted
needs: build
steps:
- name: Download output artifact for release
uses: actions/download-artifact@v4
with:
name: output
- name: Publish Release on GitHub
env:
GITHUB_TOKEN: $GITHUB_TOKEN
run: |
VERSION=$(cat ./output/version.txt)
gh release create $VERSION ./output/ShaderToy-Chrome-Plugin-$VERSION.zip --title "$VERSION" --notes "Release of version $VERSION"