-
Notifications
You must be signed in to change notification settings - Fork 868
171 lines (153 loc) · 5 KB
/
build_action.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
168
169
170
171
name: Build Action Release
on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
workflow_call:
inputs:
ref:
default: 'dev'
type: string
auto_update_file:
default: 'canary.xml'
type: string
build_xpi:
default: false
type: boolean
outputs:
version:
value: ${{ jobs.zip.outputs.version }}
buildXPI:
value: ${{ jobs.xpi.outputs.exist_xpi_file }}
secrets:
CRX_PRIVATE_KEY:
required: true
jobs:
build:
name: Build dist
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
fetch-depth: ${{ github.event_name == 'pull_request' && 1 || 0 }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: yarn
- run: yarn
- run: yarn build
continue-on-error: true
- name: Upload Built to action
uses: actions/upload-artifact@v4
with:
name: build-dist-folder
path: dist
zip:
name: Build Zip
runs-on: ubuntu-latest
needs: build
outputs:
version: ${{ steps.zip.outputs.extensionVersion }}
steps:
- uses: actions/download-artifact@v4
with:
name: build-dist-folder
path: dist
- id: zip
name: Build Zip
uses: cardinalby/webext-buildtools-pack-extension-dir-action@v1
with:
extensionDir: 'dist'
zipFilePath: 'artifact/extension.zip'
- name: Upload Built Zip to action
uses: actions/upload-artifact@v4
with:
name: dev-build-${{ steps.zip.outputs.extensionVersion }}-zip
path: artifact/*
crx:
name: Build Crx (Chromium)
runs-on: ubuntu-latest
needs: build
steps:
- name: Set name output
id: auto_update_file
env:
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }}
if: ${{ env.CRX_PRIVATE_KEY != '' }}
run: |
USER_INPUT=${{ inputs.auto_update_file }}
echo "value=${USER_INPUT:-"stable.xml"}" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
env:
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }}
if: ${{ env.CRX_PRIVATE_KEY != '' }}
with:
name: build-dist-folder
path: dist
- name: Add update_url
env:
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }}
if: ${{ env.CRX_PRIVATE_KEY != '' }}
run: echo $(jq '. |= .+ {"update_url":"https://pt-plugins.github.io/PT-Plugin-Plus/update/${{ steps.auto_update_file.outputs.value }}"}' dist/manifest.json) > dist/manifest.json
- id: zip
name: Build Zip With update_url
uses: cardinalby/webext-buildtools-pack-extension-dir-action@v1
env:
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }}
if: ${{ env.CRX_PRIVATE_KEY != '' }}
with:
extensionDir: 'dist'
zipFilePath: 'extension.zip'
- name: Build Crx
env:
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }}
if: ${{ env.CRX_PRIVATE_KEY != '' }}
uses: cardinalby/webext-buildtools-chrome-crx-action@v2
with:
zipFilePath: 'extension.zip'
crxFilePath: 'artifact/extension.crx'
privateKey: ${{ secrets.CRX_PRIVATE_KEY }}
updateXmlPath: artifact/${{ steps.auto_update_file.outputs.value }}
updateXmlCodebaseUrl: https://github.com/pt-plugins/PT-Plugin-Plus/releases/download/v${{ steps.zip.outputs.extensionVersion }}/PT-Plugin-Plus-${{ steps.zip.outputs.extensionVersion }}.crx
- name: Upload Built Crx to action
env:
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }}
if: ${{ env.CRX_PRIVATE_KEY != '' }}
uses: actions/upload-artifact@v4
with:
name: dev-build-${{ steps.zip.outputs.extensionVersion }}-crx
path: artifact/*
xpi:
name: Build Xpi (Firefox)
runs-on: ubuntu-latest
needs: zip
if: ${{ inputs.build_xpi }}
outputs:
exist_xpi_file: ${{ steps.addonsDeploy.outcome }}
steps:
- uses: actions/download-artifact@v4
with:
name: dev-build-${{ needs.zip.outputs.version }}-zip
- uses: cardinalby/webext-buildtools-firefox-sign-xpi-action@v1
id: addonsDeploy
if: ${{ env.FF_EXT_UUID != '' }}
env:
FF_EXT_UUID: ${{ secrets.FF_EXT_UUID }}
continue-on-error: true
with:
timeoutMs: 600000
zipFilePath: extension.zip
xpiFilePath: artifact/extension.signed.xpi
extensionId: ${{ secrets.FF_EXT_UUID }}
jwtIssuer: ${{ secrets.FF_JWT_ISSUER }}
jwtSecret: ${{ secrets.FF_JWT_SECRET }}
- name: Upload Built Xpi to action
uses: actions/upload-artifact@v4
if: ${{ steps.addonsDeploy.outcome == 'success' }}
with:
name: dev-build-${{ needs.zip.outputs.version }}-xpi
path: artifact/*