@@ -7,10 +7,11 @@ const UPDATE_URL = 'https://raw.githubusercontent.com/mbnuqw/sidebery/v5/updates
7
7
8
8
async function main ( ) {
9
9
// Parse arguments
10
- const versionRE = / \d \d ? \. \d \d ? \. \d \d ? \. ? \d ? \d ? /
10
+ const versionRE = / ^ \d \d ? \. \d \d ? \. \d \d ? \. ? \d ? \d ? \d ? $ /
11
11
const version = process . argv [ process . argv . length - 1 ]
12
12
const is4Digit = version . split ( '.' ) . length === 4
13
13
const preserveVersion = process . argv . some ( arg => arg === '--preserve' )
14
+ const sign = process . argv . some ( arg => arg === '--sign' )
14
15
if ( ! versionRE . test ( version ) ) {
15
16
console . log ( '\nWrong target version (the last argument)' )
16
17
return
@@ -64,14 +65,7 @@ async function main() {
64
65
65
66
// Build ('build')
66
67
console . log ( 'Preparing code...' )
67
- await execSync ( 'node ./build/all.js' , { encoding : 'utf-8' , stdio : 'inherit' } )
68
-
69
- // Create './dist/sidebery-X.zip' ('build.ext')
70
- console . log ( 'Creating addon...' )
71
- await execSync ( 'npx web-ext build --source-dir ./addon -a ./dist/ -i __tests__' , {
72
- encoding : 'utf-8' ,
73
- stdio : 'inherit' ,
74
- } )
68
+ execSync ( 'node ./build/all.js' , { encoding : 'utf-8' , stdio : 'inherit' } )
75
69
76
70
// Revert version in package.json, package-lock.json and manifest.json
77
71
const revertVersion = ! preserveVersion && prevVersion && version !== prevVersion
@@ -114,6 +108,31 @@ async function main() {
114
108
return
115
109
}
116
110
}
111
+
112
+ // Create './dist/sidebery-X.zip' ('build.ext')
113
+ console . log ( 'Creating addon archive...' )
114
+ execSync ( 'npx web-ext build --source-dir ./addon -a ./dist/ -i __tests__' , {
115
+ encoding : 'utf-8' ,
116
+ stdio : 'inherit' ,
117
+ } )
118
+
119
+ // Sign
120
+ if ( is4Digit && sign ) {
121
+ console . log ( 'Signing addon...' )
122
+
123
+ if ( ! process . env . WEB_EXT_API_KEY || ! process . env . WEB_EXT_API_SECRET ) {
124
+ console . log ( '\nNo API key or secret' )
125
+ return
126
+ }
127
+
128
+ execSync (
129
+ 'npx web-ext sign --use-submission-api --channel unlisted --source-dir ./addon -a ./dist/ -i __tests__' ,
130
+ {
131
+ encoding : 'utf-8' ,
132
+ stdio : 'inherit' ,
133
+ }
134
+ )
135
+ }
117
136
}
118
137
119
- main ( )
138
+ await main ( )
0 commit comments