-
Notifications
You must be signed in to change notification settings - Fork 358
write id to file upon successful submission #2511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -286,7 +286,9 @@ export default class Client { | |
async postNewAddon( | ||
xpiPath: string, | ||
channel: string, | ||
metaDataJson: Object | ||
savedIdPath: string, | ||
metaDataJson: Object, | ||
saveIdToFileFunc: (string, string) => Promise<void> = saveIdToFile, | ||
): Promise<SignResult> { | ||
const uploadUuid = await this.doUploadSubmit(xpiPath, channel); | ||
|
||
|
@@ -297,6 +299,11 @@ export default class Client { | |
[versionObject]: {id: newVersionId}, | ||
} = await this.doNewAddonSubmit(uploadUuid, metaDataJson); | ||
|
||
await saveIdToFileFunc(savedIdPath, addonId); | ||
log.info(`Generated extension ID: ${addonId}.`); | ||
log.info('You must add the following to your manifest:'); | ||
log.info(`"browser_specific_settings": {"gecko": "${addonId}"}`); | ||
Comment on lines
+303
to
+305
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we move There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The We only call the function for |
||
|
||
const fileUrl = new URL(await this.waitForApproval(addonId, newVersionId)); | ||
|
||
return this.downloadSignedFile(fileUrl, addonId); | ||
|
@@ -332,6 +339,7 @@ type signAddonParams = {| | |
xpiPath: string, | ||
downloadDir: string, | ||
channel: string, | ||
savedIdPath: string, | ||
metaDataJson?: Object, | ||
SubmitClient?: typeof Client, | ||
ApiAuthClass?: typeof JwtApiAuth, | ||
|
@@ -346,6 +354,7 @@ export async function signAddon({ | |
xpiPath, | ||
downloadDir, | ||
channel, | ||
savedIdPath, | ||
metaDataJson = {}, | ||
SubmitClient = Client, | ||
ApiAuthClass = JwtApiAuth, | ||
|
@@ -378,8 +387,20 @@ export async function signAddon({ | |
// We specifically need to know if `id` has not been passed as a parameter because | ||
// it's the indication that a new add-on should be created, rather than a new version. | ||
if (id === undefined) { | ||
return client.postNewAddon(xpiPath, channel, metaDataJson); | ||
return client.postNewAddon(xpiPath, channel, savedIdPath, metaDataJson); | ||
} | ||
|
||
return client.putVersion(xpiPath, channel, id, metaDataJson); | ||
} | ||
|
||
export async function saveIdToFile( | ||
filePath: string, id: string | ||
): Promise<void> { | ||
await fsPromises.writeFile(filePath, [ | ||
'# This file was created by https://github.com/mozilla/web-ext', | ||
'# Your auto-generated extension ID for addons.mozilla.org is:', | ||
id.toString(), | ||
].join('\n')); | ||
|
||
log.debug(`Saved auto-generated ID ${id} to ${filePath}`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit,
saveIdToSourceDir
=>saveIdToFile
in this inline comment?