-
-
Notifications
You must be signed in to change notification settings - Fork 108
56 lines (49 loc) · 2.28 KB
/
publish.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
name: Publish to Webstores
on:
push:
tags:
- 'v*'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- name: Install Required NPM packages
run: |
npm install jwtgen
- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: TODO
draft: false
prerelease: false
- name: Deploy to Firefox
env:
APP_ID: '{287dcf75-bec6-4eec-b4f6-71948a2eea29}'
CLIENT_ID: ${{ secrets.MOZ_DEPLOY_JWT_ISSUER }}
CLIENT_SECRET: ${{ secrets.MOZ_DEPLOY_JWT_SECRET }}
run: |
jq -s '.[0] * .[1]' manifest.base.json manifest.gecko.json > manifest.json
git add manifest.json
git archive -o package.zip HEAD
VERSION_NUMBER=$(jq -r .version manifest.json)
ACCESS_TOKEN=$(npx jwtgen -a HS256 -s ${CLIENT_SECRET} -c "iss=${CLIENT_ID}" -e 300)
curl -H "Authorization: JWT ${ACCESS_TOKEN}" -g -XPUT --form "[email protected]" "https://addons.mozilla.org/api/v4/addons/${APP_ID}/versions/${VERSION_NUMBER}/"
- name: Deploy to Chrome
env:
APP_ID: 'jpcmhcelnjdmblfmjabdeclccemkghjk'
CLIENT_ID: ${{ secrets.CHROME_DEPLOY_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CHROME_DEPLOY_CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.CHROME_DEPLOY_REFRESH_TOKEN }}
run: |
jq -s '.[0] * .[1]' manifest.base.json manifest.blink.json > manifest.json
git add manifest.json
git archive -o package.zip HEAD
ACCESS_TOKEN=$(curl "https://accounts.google.com/o/oauth2/token" -d "client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&refresh_token=${REFRESH_TOKEN}&grant_type=refresh_token&redirect_uri=urn:ietf:wg:oauth:2.0:oob" | jq -r .access_token)
curl -H "Authorization: Bearer ${ACCESS_TOKEN}" -H "x-goog-api-version: 2" -X PUT -T package.zip "https://www.googleapis.com/upload/chromewebstore/v1.1/items/${APP_ID}"
curl -H "Authorization: Bearer ${ACCESS_TOKEN}" -H "x-goog-api-version: 2" -H "Content-Length: 0" -X POST "https://www.googleapis.com/chromewebstore/v1.1/items/${APP_ID}/publish"