Skip to content
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

feat: upgrade Keygen integration to v1.1 #6941

Conversation

ezekg
Copy link
Contributor

@ezekg ezekg commented Jun 13, 2022

Follow up to #6909, which covers the API changes more in-depth. This should have no breaking changes for app's that are upgrading from v1.0 to v1.1 of the API, since it's only related to publishing (the auto-upgrade functionality still works as it did before from a consumer standpoint), so I think it's safe to include in a minor electron-builder update.

I don't think this should be merged until #6920 is out, to give an option to pin to v1.0 for whatever reason (via #6909).

@changeset-bot
Copy link

changeset-bot bot commented Jun 13, 2022

🦋 Changeset detected

Latest commit: d1cf92c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
app-builder-lib Minor
electron-updater Minor
dmg-builder Minor
electron-builder-squirrel-windows Minor
electron-builder Minor
electron-forge-maker-appimage Minor
electron-forge-maker-nsis-web Minor
electron-forge-maker-nsis Minor
electron-forge-maker-snap Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Jun 13, 2022

Deploy Preview for car-park-attendant-cleat-11576 ready!

Name Link
🔨 Latest commit d1cf92c
🔍 Latest deploy log https://app.netlify.com/sites/car-park-attendant-cleat-11576/deploys/62a771f5cc9c32000906c948
😎 Deploy Preview https://deploy-preview-6941--car-park-attendant-cleat-11576.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ezekg ezekg force-pushed the feature/upgrade-keygen-publisher-to-v1-1 branch from 808b4c7 to f3079f9 Compare June 13, 2022 15:35
@ezekg ezekg force-pushed the feature/upgrade-keygen-publisher-to-v1-1 branch 2 times, most recently from 25ed88a to 733e4c5 Compare June 13, 2022 16:15
@ezekg ezekg force-pushed the feature/upgrade-keygen-publisher-to-v1-1 branch from 733e4c5 to d1cf92c Compare June 13, 2022 17:20
@ezekg ezekg changed the title feat: upgrade keygen integration to v1.1 feat: upgrade Keygen integration to v1.1 Jun 13, 2022
attributes: {
version: this.version,
channel: this.info.channel || "stable",
status: "PUBLISHED",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to start with a DRAFT status for the release, and publish only after all artifacts are uploaded, but I couldn't find a hook to accomplish that (i.e. letting the publisher perform an additional request once all artifacts are uploaded). LMK if one exists and I just happened to miss it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I don't see any in the code for that functionality, but it totally seems like a valid reason to have one added :)
Seems like an onArtifactUploaded could be added here? Simply need to add a task (i.e. Promise) to the taskManager after the scheduleUpload

packager.artifactCreated(event => {
const publishConfiguration = event.publishConfig
if (publishConfiguration == null) {
this.taskManager.addTask(this.artifactCreatedWithoutExplicitPublishConfig(event))
} else if (this.isPublish) {
if (debug.enabled) {
debug(`artifactCreated (isPublish: ${this.isPublish}): ${safeStringifyJson(event, new Set(["packager"]))},\n publishConfig: ${safeStringifyJson(publishConfiguration)}`)
}
this.scheduleUpload(publishConfiguration, event, this.getAppInfo(event.packager))
}
})

From my quick look, an onAllArtifactsUploaded hook could probably be added here:

async awaitTasks(): Promise<void> {
await this.taskManager.awaitTasks()
const updateInfoFileTasks = this.updateFileWriteTask
if (this.cancellationToken.cancelled || updateInfoFileTasks.length === 0) {
return
}
await writeUpdateInfoFiles(updateInfoFileTasks, this.packager)
await this.taskManager.awaitTasks()
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If only adding onAllArtifactsUploaded, which is probably all we need for now, the best place might just be adding it here:

promise = publishManager.awaitTasks()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about doing that in a separate follow-up PR, and then updating the Keygen publisher while I'm there. Is that cool? As-is, I think the current publisher works even if it does skip the draft stage.

Copy link
Collaborator

@mmaietta mmaietta Jun 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me 😄
I think this is Ready for Review then? Merge button is disabled atm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's ready for review but I wanted to wait until #6920 is out (which includes #6909) before we consider merging it, so I'm keeping the PR in draft mode. Detailed more of the reasoning there in the PR description.

LMK if you want me to move it out of a draft state. 👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Published 23.2.0 + electron-updater@5.0.6

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Marked this as ready for review. 👍

@ezekg ezekg marked this pull request as ready for review June 17, 2022 20:08
@mmaietta mmaietta merged commit 14503ce into electron-userland:master Jun 17, 2022
@github-actions github-actions bot mentioned this pull request Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants