Skip to content

Commit

Permalink
[Add] Support for a separate Github release token to the auto-update …
Browse files Browse the repository at this point in the history
…token

Reference: electron-userland#5688 - Discussion about keeping two separate tokens; one for publishing to Github releases and the other used by the app to make requests for auto-update updates.

Now you can set a release token that has write permissions to publish your release.

The release token will be used instead of a GH_TOKEN || GITHUB_TOKEN ONLY during publishing.

The Github token defined via the Github options or environment variable will still be used as normal.

mac: ``` export GITHUB_RELEASE_TOKEN=<my token> ```

I used the Contents permission for a New fine-grained personal access token with "Read and write". "Read-only" for the usual app-update token.

So even if the app-update token is inside your app-update.yml its only read-only, yay! (Mac: you can find the app-update.yml by right-click > Show Package Contents > Contents > Resources)
  • Loading branch information
AndrewEQ committed Apr 12, 2024
1 parent fa6fc16 commit abea7ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/electron-publish/src/gitHubPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export class GitHubPublisher extends HttpPublisher {
super(context, true)

let token = info.token
if (isEmptyOrSpaces(token)) {
token = process.env.GH_TOKEN || process.env.GITHUB_TOKEN
if (isEmptyOrSpaces(token) || process.env.GITHUB_RELEASE_TOKEN) {
token = process.env.GITHUB_RELEASE_TOKEN ? process.env.GITHUB_RELEASE_TOKEN : (process.env.GH_TOKEN || process.env.GITHUB_TOKEN)
if (isEmptyOrSpaces(token)) {
throw new InvalidConfigurationError(`GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"`)
}
Expand Down

0 comments on commit abea7ed

Please sign in to comment.