How to use the electron-publish.getCiTag function in electron-publish

To help you get started, we’ve selected a few electron-publish examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github electron-userland / electron-builder / packages / app-builder-lib / src / publish / PublishManager.ts View on Github external
if (publishConfig.provider === "generic") {
      return
    }

    const publisher = this.getOrCreatePublisher(publishConfig, appInfo)
    if (publisher == null) {
      log.debug({
        file: event.file,
        reason: "publisher is null",
        publishConfig: safeStringifyJson(publishConfig),
      }, "not published")
      return
    }

    const providerName = publisher.providerName
    if (this.publishOptions.publish === "onTagOrDraft" && getCiTag() == null && !(providerName === "GitHub" || providerName === "Bintray")) {
      log.info({file: event.file, reason: "current build is not for a git tag", publishPolicy: "onTagOrDraft"}, `not published to ${providerName}`)
      return
    }

    this.taskManager.addTask(publisher.upload(event))
  }
github electron-userland / electron-builder / packages / app-builder-lib / src / publish / PublishManager.ts View on Github external
}
        else {
          const tag = getCiTag()
          if (tag != null) {
            log.info({reason: "tag is defined", tag}, "artifacts will be published")
            publishOptions.publish = "onTag"
          }
          else if (isCi) {
            log.info({reason: "CI detected"}, "artifacts will be published if draft release exists")
            publishOptions.publish = "onTagOrDraft"
          }
        }
      }

      const publishPolicy = publishOptions.publish
      this.isPublish = publishPolicy != null && publishOptions.publish !== "never" && (publishPolicy !== "onTag" || getCiTag() != null)
      if (this.isPublish && forcePublishForPr) {
        log.warn(publishForPrWarning)
      }
    }
    else if (publishOptions.publish !== "never") {
      log.info({
        reason: "current build is a part of pull request",
        solution: `set env PUBLISH_FOR_PULL_REQUEST to true to force code signing\n${publishForPrWarning}`,
      }, "publishing will be skipped")
    }

    packager.addAfterPackHandler(async event => {
      const packager = event.packager
      if (event.electronPlatformName === "darwin") {
        if (!event.targets.some(it => it.name === "dmg" || it.name === "zip")) {
          return
github electron-userland / electron-builder / packages / app-builder-lib / src / publish / PublishManager.ts View on Github external
constructor(private readonly packager: Packager, private readonly publishOptions: PublishOptions, readonly cancellationToken: CancellationToken = packager.cancellationToken) {
    checkOptions(publishOptions.publish)

    this.taskManager = new AsyncTaskManager(cancellationToken)

    const forcePublishForPr = process.env.PUBLISH_FOR_PULL_REQUEST === "true"
    if (!isPullRequest() || forcePublishForPr) {
      if (publishOptions.publish === undefined) {
        if (process.env.npm_lifecycle_event === "release") {
          publishOptions.publish = "always"
        }
        else {
          const tag = getCiTag()
          if (tag != null) {
            log.info({reason: "tag is defined", tag}, "artifacts will be published")
            publishOptions.publish = "onTag"
          }
          else if (isCi) {
            log.info({reason: "CI detected"}, "artifacts will be published if draft release exists")
            publishOptions.publish = "onTagOrDraft"
          }
        }
      }

      const publishPolicy = publishOptions.publish
      this.isPublish = publishPolicy != null && publishOptions.publish !== "never" && (publishPolicy !== "onTag" || getCiTag() != null)
      if (this.isPublish && forcePublishForPr) {
        log.warn(publishForPrWarning)
      }

electron-publish

Part of [electron-builder](https://github.com/electron-userland/electron-builder).

MIT
Latest version published 2 days ago

Package Health Score

95 / 100
Full package analysis

Similar packages