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

refactor: update Bitbucket publisher #6400

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/spotty-clouds-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"app-builder-lib": patch
"builder-util-runtime": patch
"builder-util": patch
---

refactor: update Bitbucket publisher to have optional config options for Token and Username (Bitbucket Private Repos)

6 changes: 3 additions & 3 deletions packages/app-builder-lib/src/publish/BitbucketPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { HttpPublisher, PublishContext } from "electron-publish"
import { BitbucketOptions } from "builder-util-runtime/out/publishOptions"
import { configureRequestOptions, HttpExecutor } from "builder-util-runtime"
import * as FormData from "form-data"
import { readFile } from "fs/promises"
import { readFile } from "fs-extra"

export class BitbucketPublisher extends HttpPublisher {
readonly providerName = "bitbucket"
Expand All @@ -18,8 +18,8 @@ export class BitbucketPublisher extends HttpPublisher {
constructor(context: PublishContext, info: BitbucketOptions) {
super(context)

const token = process.env.BITBUCKET_TOKEN
const username = process.env.BITBUCKET_USERNAME
const token = info.token || process.env.BITBUCKET_TOKEN || null
const username = info.username || process.env.BITBUCKET_USERNAME || null

if (isEmptyOrSpaces(token)) {
throw new InvalidConfigurationError(`Bitbucket token is not set using env "BITBUCKET_TOKEN" (see https://www.electron.build/configuration/publish#BitbucketOptions)`)
Expand Down
10 changes: 10 additions & 0 deletions packages/builder-util-runtime/src/publishOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ export interface BitbucketOptions extends PublishConfiguration {
*/
readonly owner: string

/**
* The access token to support auto-update from private bitbucket repositories.
*/
readonly token?: string | null

/**
* The user name to support auto-update from private bitbucket repositories.
*/
readonly username?: string | null

/**
* Repository slug/name
*/
Expand Down