-
-
Notifications
You must be signed in to change notification settings - Fork 3
167 lines (143 loc) · 5.06 KB
/
extension-release.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Firefox & Chrome Web Extension Release
on:
push:
branches:
- master
jobs:
release:
name: "Create a release"
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: "Get Version"
run: echo "VERSION=$(jq -r '.version' manifest.json)" >> $GITHUB_ENV
- name: "Echo Version"
run: echo $VERSION
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: skribbltypo-release-${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
body: Stable release of skribbl typo, version ${{ env.VERSION }}
draft: false
prerelease: false
publish-chrome:
needs: release
name: "Release Chrome Web Ext"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: "Get Version"
run: echo "VERSION=$(jq -r '.version' manifest.json)" >> $GITHUB_ENV
- name: "Echo Version"
run: echo $VERSION
- name: Archive Release
uses: thedoctor0/zip-release@master
with:
filename: typo-chromium-release-${{ env.VERSION }}.zip
exclusions: "*.git* *.xpi skribbltypo.user.js userscript-gen.js readme.md patch.json /*extensions/* *.web-extension-id .editorconfig .github/"
- name: Append to artifacts
uses: actions/upload-artifact@v3
with:
name: typo-chromium-release-${{ env.VERSION }}
path: typo-chromium-release-${{ env.VERSION }}.zip
- name: Append to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: typo-chromium-release-${{ env.VERSION }}.zip
asset_name: typo-chromium-release-${{ env.VERSION }}.zip
asset_content_type: application/zip
publish-firefox:
needs: release
name: "Release Firefox Web Ext"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: "Get Version"
run: echo "VERSION=$(jq -r '.version' manifest.json)" >> $GITHUB_ENV
- name: "Echo Version"
run: echo $VERSION
- name: "web-ext build"
id: web-ext-build
uses: kewisch/action-web-ext@v1
with:
cmd: build
source: ./
exclusions: '["skribbltypo.user.js", "userscript-gen.js"," patch.json", "/*extensions/*"]'
- name: "web-ext sign"
id: web-ext-sign
uses: kewisch/action-web-ext@v1
with:
cmd: sign
source: ${{ steps.web-ext-build.outputs.target }}
channel: unlisted
apiKey: ${{ secrets.MOZILLA_API_KEY }}
apiSecret: ${{ secrets.MOZILLA_API_SECRET }}
timeout: 900000
- name: Archive signed XPI
uses: actions/upload-artifact@v3
with:
name: typo-firefox-signed-release-${{env.VERSION}}
path: ${{ steps.web-ext-sign.outputs.target }}
- name: "Publish update to tobeh.host"
env:
FILE_PATH: ${{ steps.web-ext-sign.outputs.target }}
VERSION: ${{env.VERSION}}
AUTH: ${{ secrets.FF_UPDATE_AUTH }}
SCRIPT_URL: ${{ secrets.FF_UPDATE_URL }}
run: |
curl -X POST -F "file=@$FILE_PATH" -F "version=$VERSION" -F "auth=$AUTH" $SCRIPT_URL
- name: Append to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ steps.web-ext-sign.outputs.target }}
asset_name: typo-firefox-signed-release-${{env.VERSION}}.xpi
asset_content_type: application/x-xpinstall
# create GitHub Pages release
- name: "Create dist directory"
run: mkdir -p dist
- name: "Copy XPI to dist"
run: cp ${{ steps.web-ext-sign.outputs.target }} ./dist/typo-firefox-release-${{ env.VERSION }}.xpi
- name: "Create updates.json"
run: |
echo '{
"addons": {
"{0b67dc2f-1517-451c-b5cb-8b28270b03e6}": {
"updates": [
{
"version": "'${{ env.VERSION }}'",
"update_link": "https://toobeeh.github.io/skribbltypo/typo-firefox-release-${{ env.VERSION }}.xpi"
}
]
}
}
}' > ./dist/updates.json
- name: Upload to GitHub Pages
uses: actions/upload-pages-artifact@v1
with:
path: ./dist
deploy-pages:
needs: publish-firefox
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v2