samuelmeuli / action-electron-builder

:electron: GitHub Action for building and releasing Electron apps
MIT License
670 stars 207 forks source link

something wrong with dmg & zip notarize #75

Open toimc opened 2 years ago

toimc commented 2 years ago

Q: When I change the electron-builder configuration the target of mac from 'dmg' to 'dmg, zip', the notarize would failed.

My actions result: https://github.com/toimc/electron-vite-demo-lesson/actions/runs/1489990900

My Environment:

Electron 16.0.1
Electron builder: 22.14.5

electron-builder.config.js

const path = require('path')

if (process.env.VITE_APP_VERSION === undefined) {
  const now = new Date()
  process.env.VITE_APP_VERSION = `${now.getUTCFullYear() - 2000}.${
    now.getUTCMonth() + 1
  }.${now.getUTCDate()}-${now.getUTCHours() * 60 + now.getUTCMinutes()}`
}

/**
 * @type {import('electron-builder').Configuration}
 * @see https://www.electron.build/configuration/configuration
 */
const config = {
  appId: 'com.toimc.community.desktop',
  directories: {
    output: 'dist',
    buildResources: 'buildResources'
  },
  files: ['packages/**/dist/**', 'packages/main/locales/**'],
  extraMetadata: {
    version: process.env.VITE_APP_VERSION
    // version: '1.0.0'
  },
  productName: 'toimc技术社区HD',
  dmg: {
    background: 'buildResources/background.tiff'
  },
  publish: {
    provider: 'github'
  },
  mac: {
    category: 'public.app-category.lifestyle',
    hardenedRuntime: true,
    icon: 'buildResources/icon.icns',

    target: ['dmg', 'zip'], // the line will cause the failure

    // target: ['dmg']  // this would be fine, all the notarize and pack good.
    entitlements: 'buildResources/entitlements.mac.plist',
    entitlementsInherit: 'buildResources/entitlements.mac.plist',
    provisioningProfile: path.join(__dirname, './buildResources/toimchd.provisionprofile')
    // bundleVersion: 2,
    // bundleShortVersion: 1.0.0
  },
  win: {
    target: ['nsis', 'zip']
    // verifyUpdateCodeSignature: false,
    // signingHashAlgorithms: ['sha256'],
    // certificateFile: 'XXX.pfx',
    // certificatePassword: 'XXXX'
  },
  nsis: {
    oneClick: false,
    allowToChangeInstallationDirectory: true,
    shortcutName: 'toimc技术社区'
  },
  linux: {
    target: ['deb', 'tar.xz'],
    category: 'Office',
    executableName: 'toimc-community',
    icon: 'buildResources/icon.png'
  },
  // afterSign: 'scripts/notarize.js'
  afterSign: 'electron-builder-notarize'
}

module.exports = config

My Github Action Config:

name: Release
on:
  push:
    branches:
      - main
      - master
    paths-ignore:
      - "**.md"
      - "**.spec.js"
      - ".idea"
      - ".gitignore"
      - ".github/**"
      - "!.github/workflows/release.yml"
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

concurrency:
  group: release-${{ github.ref }}
  cancel-in-progress: true

defaults:
  run:
    shell: "bash"

jobs:
  draft:
    runs-on: ubuntu-latest
    outputs:
      release-note: ${{ steps.release-note.outputs.release-note }}
      version: ${{ steps.version.outputs.build-version }}

    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - uses: actions/setup-node@v2
        with:
          node-version: 14

      - name: Get last git tag
        id: tag
        run: echo "::set-output name=last-tag::$(git describe --tags --abbrev=0 || git rev-list --max-parents=0 ${{github.ref}})"

      - name: Generate release notes
        uses: ./.github/actions/release-notes
        id: release-note
        with:
          from: ${{ steps.tag.outputs.last-tag }}
          to: ${{ github.ref }}
          include-commit-body: true
          include-abbreviated-commit: true

      - name: Get version from current date
        id: version
        run: echo "::set-output name=build-version::$(node -e "try{console.log(require('./electron-builder.config.js').extraMetadata.version)}catch(e){console.error(e);process.exit(1)}")"

      - name: Waiting on All checks
        uses: lewagon/wait-on-check-action@v0.2
        with:
          ref: ${{ github.ref }}
          repo-token: ${{ secrets.GH_TOKEN }}
          running-workflow-name: "draft"

      - name: Delete outdated drafts
        uses: hugo19941994/delete-draft-releases@v1.0.0
        env:
          GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

      - name: Create Release Draft
        uses: softprops/action-gh-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
        with:
          prerelease: true
          draft: true
          tag_name: v${{ steps.version.outputs.build-version }}
          name: v${{ steps.version.outputs.build-version }}
          body: ${{ steps.release-note.outputs.release-note }}

  upload_artifacts:
    needs: [draft]

    strategy:
      matrix:
        os: [windows-latest, macos-latest, ubuntu-latest]
    #    To compile the application for different platforms, use:
    #    os: [ macos-latest, ubuntu-latest, windows-latest ]

    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2
        with:
          node-version: 16 # Need for npm >=7.7
          cache: "npm"

      - name: Install dependencies
        run: npm ci

      # The easiest way to transfer release notes to a compiled application is create `release-notes.md` in the build resources.
      # See https://github.com/electron-userland/electron-builder/issues/1511#issuecomment-310160119
      - name: Prepare release notes
        env:
          RELEASE_NOTE: ${{ needs.draft.outputs.release-note }}
        run: echo "$RELEASE_NOTE" >> ./buildResources/release-notes.md

      - name: Prepare for app notarization
        if: startsWith(matrix.os, 'macos')
        # Import Apple API key for app notarization on macOS
        run: |
          mkdir -p ~/private_keys/
          echo '${{ secrets.api_key }}' > ~/private_keys/AuthKey_${{ secrets.api_key_id }}.p8

      # Compile app and upload artifacts
      - name: Compile & release Electron app
        uses: samuelmeuli/action-electron-builder@v1
        env:
          VITE_APP_VERSION: ${{ needs.draft.outputs.version }}
          # macOS notarization API key
          API_KEY_ID: ${{ secrets.api_key_id }}
          API_KEY_ISSUER_ID: ${{ secrets.api_key_issuer_id }}
        with:
          build_script_name: build
          args: --config electron-builder.config.js

          # GitHub token, automatically provided to the action
          # (No need to define this secret in the repo settings)
          github_token: ${{ secrets.GH_TOKEN }}

          # If the commit is tagged with a version (e.g. "v1.0.0"),
          # release the app after building
          release: true

          # Sometimes the build may fail due to a connection problem with Apple, GitHub, etc. servers.
          # This option will restart the build as many attempts as possible
          max_attempts: 3

          # Code Signing params

          # Base64-encoded code signing certificate for Windows
          # windows_certs: ''

          # Password for decrypting `windows_certs`
          # windows_certs_password: ''

          # Base64-encoded code signing certificate for macOS
          mac_certs: ${{ secrets.mac_certs }}

          # Password for decrypting `mac_certs`
          mac_certs_password: ${{ secrets.mac_certs_password }}

Q: When I change the target of mac from 'dmg' to 'dmg, zip', the notarize would failed.

Total bundling time: 13.675s

Building and releasing the Electron app…
  • electron-builder  version=22.14.5 os=20.6.0
  • loaded configuration  file=/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/electron-builder.config.js
  • packaging       platform=darwin arch=x64 electron=16.0.1 appOutDir=dist/mac
  • downloading     url=https://github.com/electron/electron/releases/download/v16.0.1/electron-v16.0.1-darwin-x64.zip size=83 MB parts=6
  • downloaded      url=https://github.com/electron/electron/releases/download/v16.0.1/electron-v16.0.1-darwin-x64.zip duration=2.761s
  • signing         file=dist/mac/toimc技术社区HD.app identityName=Developer ID Application: Wuhan Wei'en Technology Co., Ltd (UBB3B7LZSN) identityHash=CFB107F113F4202566CF6E2DFDCBFD7B2D69A039 provisioningProfile=/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/buildResources/toimchd.provisionprofile
Notarizing com.toimc.community.desktop found at /Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/dist/mac/toimc技术社区HD.app
Done notarizing com.toimc.community.desktop
  • building        target=macOS zip arch=x64 file=dist/toimc技术社区HD-21.11.22-703-mac.zip
  • building        target=DMG arch=x64 file=dist/toimc技术社区HD-21.11.22-703.dmg
  • building block map  blockMapFile=dist/toimc技术社区HD-21.11.22-703-mac.zip.blockmap
  • publishing      publisher=Github (owner: toimc, project: electron-vite-demo-lesson, version: 21.11.22-703)
  • uploading       file=toimc技术社区HD-21.11.22-703-mac.zip.blockmap provider=GitHub
  • uploading       file=vite-electron-builder-21.11.22-703-mac.zip provider=GitHub
  • building block map  blockMapFile=dist/toimc技术社区HD-21.11.22-703.dmg.blockmap
  • uploading       file=vite-electron-builder-21.11.22-703.dmg.blockmap provider=GitHub
  • uploading       file=vite-electron-builder-21.11.22-703.dmg provider=GitHub
  ⨯ Request path contains unescaped characters  failedTask=build stackTrace=TypeError: Request path contains unescaped characters
    at new NodeError (node:internal/errors:371:5)
    at new ClientRequest (node:_http_client:154:13)
    at request (node:https:353:10)
    at NodeHttpExecutor.createRequest (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util/src/nodeHttpExecutor.ts:9:72)
    at /Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:111:28
    at /Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/CancellationToken.ts:83:7
    at new Promise (<anonymous>)
    at CancellationToken.createPromise (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/CancellationToken.ts:62:12)
    at NodeHttpExecutor.doApiRequest (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:110:30)
    at GitHubPublisher.doUploadFile (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/electron-publish/src/gitHubPublisher.ts:182:8)
    at Timeout._onTimeout (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/electron-publish/src/gitHubPublisher.ts:210:20)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)

Attempt 1 failed:

Error: Command failed: npx --no-install electron-builder --mac --publish always --config electron-builder.config.js
  • electron-builder  version=22.14.5 os=20.6.0
  • loaded configuration  file=/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/electron-builder.config.js
  • packaging       platform=darwin arch=x64 electron=16.0.1 appOutDir=dist/mac
  • signing         file=dist/mac/toimc技术社区HD.app identityName=Developer ID Application: Wuhan Wei'en Technology Co., Ltd (UBB3B7LZSN) identityHash=CFB107F113F4202566CF6E2DFDCBFD7B2D69A039 provisioningProfile=/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/buildResources/toimchd.provisionprofile
Notarizing com.toimc.community.desktop found at /Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/dist/mac/toimc技术社区HD.app
Done notarizing com.toimc.community.desktop
  • building        target=macOS zip arch=x64 file=dist/toimc技术社区HD-21.11.22-703-mac.zip
  • building        target=DMG arch=x64 file=dist/toimc技术社区HD-21.11.22-703.dmg
  • building block map  blockMapFile=dist/toimc技术社区HD-21.11.22-703-mac.zip.blockmap
  • publishing      publisher=Github (owner: toimc, project: electron-vite-demo-lesson, version: 21.11.22-703)
  • uploading       file=toimc技术社区HD-21.11.22-703-mac.zip.blockmap provider=GitHub
  • uploading       file=vite-electron-builder-21.11.22-703-mac.zip provider=GitHub
  • building block map  blockMapFile=dist/toimc技术社区HD-21.11.22-703.dmg.blockmap
  • uploading       file=vite-electron-builder-21.11.22-703.dmg.blockmap provider=GitHub
  • uploading       file=vite-electron-builder-21.11.22-703.dmg provider=GitHub
  ⨯ Cannot cleanup: 

Error #1 --------------------------------------------------------------------------------
TypeError: Request path contains unescaped characters
    at new NodeError (node:internal/errors:371:5)
    at new ClientRequest (node:_http_client:154:13)
    at request (node:https:353:10)
    at NodeHttpExecutor.createRequest (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util/src/nodeHttpExecutor.ts:9:72)
    at /Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:111:28
    at /Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/CancellationToken.ts:83:7
    at new Promise (<anonymous>)
    at CancellationToken.createPromise (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/CancellationToken.ts:62:12)
    at NodeHttpExecutor.doApiRequest (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:110:30)
    at GitHubPublisher.doUploadFile (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/electron-publish/src/gitHubPublisher.ts:182:8)
    at Timeout._onTimeout (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/electron-publish/src/gitHubPublisher.ts:210:20)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)

Error #2 --------------------------------------------------------------------------------
Error: socket hang up
    at connResetException (node:internal/errors:691:14)
    at TLSSocket.socketOnEnd (node:_http_client:471:23)
    at TLSSocket.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Error #3 --------------------------------------------------------------------------------
Error: socket hang up
    at connResetException (node:internal/errors:691:14)
    at TLSSocket.socketOnEnd (node:_http_client:471:23)
    at TLSSocket.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Error #4 --------------------------------------------------------------------------------
HttpError: 422 Unprocessable Entity
"method: POST url: https://uploads.github.com/repos/toimc/electron-vite-demo-lesson/releases/53832696/assets?name=vite-electron-builder-21.11.22-703.dmg.blockmap\n\n          Data:\n          {\"message\":\"Validation Failed\",\"request_id\":\"C164:5F7A:920433:BB54A3:619B85A8\",\"documentation_url\":\"https://docs.github.com/rest\",\"errors\":[{\"resource\":\"ReleaseAsset\",\"code\":\"already_exists\",\"field\":\"name\"}]}\n          "
Headers: {
  "cache-control": "no-cache",
  "content-length": "208",
  "content-security-policy": "default-src 'none'",
  "content-type": "application/json; charset=utf-8",
  "strict-transport-security": "max-age=31557600",
  "vary": "Accept-Encoding, Accept, X-Requested-With",
  "x-content-type-options": "nosniff",
  "x-frame-options": "deny",
  "x-github-media-type": "github.v3; format=json",
  "x-github-request-id": "C164:5F7A:920433:BB54A3:619B85A8",
  "x-oauth-scopes": "repo",
  "x-xss-protection": "1; mode=block",
  "date": "Mon, 22 Nov 2021 11:57:28 GMT",
  "connection": "close"
}
    at createHttpError (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:30:10)
    at IncomingMessage.<anonymous> (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:197:13)
    at IncomingMessage.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)  failedTask=build stackTrace=Error: Cannot cleanup: 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Error #1 --------------------------------------------------------------------------------
TypeError: Request path contains unescaped characters
    at new NodeError (node:internal/errors:371:5)
    at new ClientRequest (node:_http_client:154:13)
    at request (node:https:353:10)
    at NodeHttpExecutor.createRequest (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util/src/nodeHttpExecutor.ts:9:72)
    at /Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:111:28
    at /Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/CancellationToken.ts:83:7
    at new Promise (<anonymous>)
    at CancellationToken.createPromise (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/CancellationToken.ts:62:12)
    at NodeHttpExecutor.doApiRequest (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:110:30)
    at GitHubPublisher.doUploadFile (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/electron-publish/src/gitHubPublisher.ts:182:8)
    at Timeout._onTimeout (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/electron-publish/src/gitHubPublisher.ts:210:20)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Error #2 --------------------------------------------------------------------------------
Error: socket hang up
    at connResetException (node:internal/errors:691:14)
    at TLSSocket.socketOnEnd (node:_http_client:471:23)
    at TLSSocket.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Error #3 --------------------------------------------------------------------------------
Error: socket hang up
    at connResetException (node:internal/errors:691:14)
    at TLSSocket.socketOnEnd (node:_http_client:471:23)
    at TLSSocket.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Error #4 --------------------------------------------------------------------------------
HttpError: 422 Unprocessable Entity
"method: POST url: https://uploads.github.com/repos/toimc/electron-vite-demo-lesson/releases/53832696/assets?name=vite-electron-builder-21.11.22-703.dmg.blockmap\n\n          Data:\n          {\"message\":\"Validation Failed\",\"request_id\":\"C164:5F7A:920433:BB54A3:619B85A8\",\"documentation_url\":\"https://docs.github.com/rest\",\"errors\":[{\"resource\":\"ReleaseAsset\",\"code\":\"already_exists\",\"field\":\"name\"}]}\n          "
Headers: {
  "cache-control": "no-cache",
  "content-length": "208",
  "content-security-policy": "default-src 'none'",
  "content-type": "application/json; charset=utf-8",
  "strict-transport-security": "max-age=31557600",
  "vary": "Accept-Encoding, Accept, X-Requested-With",
  "x-content-type-options": "nosniff",
  "x-frame-options": "deny",
  "x-github-media-type": "github.v3; format=json",
  "x-github-request-id": "C164:5F7A:920433:BB54A3:619B85A8",
  "x-oauth-scopes": "repo",
  "x-xss-protection": "1; mode=block",
  "date": "Mon, 22 Nov 2021 11:57:28 GMT",
  "connection": "close"
}
    at createHttpError (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:30:10)
    at IncomingMessage.<anonymous> (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:197:13)
    at IncomingMessage.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
    at throwError (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util/src/asyncTaskManager.ts:88:11)
    at checkErrors (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util/src/asyncTaskManager.ts:53:9)
    at AsyncTaskManager.awaitTasks (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util/src/asyncTaskManager.ts:67:7)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at PublishManager.awaitTasks (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/app-builder-lib/src/publish/PublishManager.ts:232:5)
    at Object.executeFinally (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util/src/promise.ts:23:3)

Attempt 2 failed:

Error: Command failed: npx --no-install electron-builder --mac --publish always --config electron-builder.config.js
  • electron-builder  version=22.14.5 os=20.6.0
  • loaded configuration  file=/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/electron-builder.config.js
  • packaging       platform=darwin arch=x64 electron=16.0.1 appOutDir=dist/mac
  • signing         file=dist/mac/toimc技术社区HD.app identityName=Developer ID Application: Wuhan Wei'en Technology Co., Ltd (UBB3B7LZSN) identityHash=CFB107F113F4202566CF6E2DFDCBFD7B2D69A039 provisioningProfile=/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/buildResources/toimchd.provisionprofile
Notarizing com.toimc.community.desktop found at /Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/dist/mac/toimc技术社区HD.app
Done notarizing com.toimc.community.desktop
  • building        target=macOS zip arch=x64 file=dist/toimc技术社区HD-21.11.22-703-mac.zip
  • building        target=DMG arch=x64 file=dist/toimc技术社区HD-21.11.22-703.dmg
  • building block map  blockMapFile=dist/toimc技术社区HD-21.11.22-703-mac.zip.blockmap
  • publishing      publisher=Github (owner: toimc, project: electron-vite-demo-lesson, version: 21.11.22-703)
  • uploading       file=toimc技术社区HD-21.11.22-703-mac.zip.blockmap provider=GitHub
  • uploading       file=vite-electron-builder-21.11.22-703-mac.zip provider=GitHub
  • building block map  blockMapFile=dist/toimc技术社区HD-21.11.22-703.dmg.blockmap
  • uploading       file=vite-electron-builder-21.11.22-703.dmg.blockmap provider=GitHub
  • uploading       file=vite-electron-builder-21.11.22-703.dmg provider=GitHub
  ⨯ Cannot cleanup: 

Error #1 --------------------------------------------------------------------------------
TypeError: Request path contains unescaped characters
    at new NodeError (node:internal/errors:371:5)
    at new ClientRequest (node:_http_client:154:13)
    at request (node:https:353:10)
    at NodeHttpExecutor.createRequest (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util/src/nodeHttpExecutor.ts:9:72)
    at /Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:111:28
    at /Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/CancellationToken.ts:83:7
    at new Promise (<anonymous>)
    at CancellationToken.createPromise (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/CancellationToken.ts:62:12)
    at NodeHttpExecutor.doApiRequest (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:110:30)
    at GitHubPublisher.doUploadFile (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/electron-publish/src/gitHubPublisher.ts:182:8)
    at Timeout._onTimeout (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/electron-publish/src/gitHubPublisher.ts:210:20)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)

Error #2 --------------------------------------------------------------------------------
Error: socket hang up
    at connResetException (node:internal/errors:691:14)
    at TLSSocket.socketOnEnd (node:_http_client:471:23)
    at TLSSocket.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Error #3 --------------------------------------------------------------------------------
HttpError: 422 Unprocessable Entity
"method: POST url: https://uploads.github.com/repos/toimc/electron-vite-demo-lesson/releases/53832696/assets?name=vite-electron-builder-21.11.22-703.dmg.blockmap\n\n          Data:\n          {\"message\":\"Validation Failed\",\"request_id\":\"C18F:0619:45DE5C:6AE72A:619B86C8\",\"documentation_url\":\"https://docs.github.com/rest\",\"errors\":[{\"resource\":\"ReleaseAsset\",\"code\":\"already_exists\",\"field\":\"name\"}]}\n          "
Headers: {
  "cache-control": "no-cache",
  "content-length": "208",
  "content-security-policy": "default-src 'none'",
  "content-type": "application/json; charset=utf-8",
  "strict-transport-security": "max-age=31557600",
  "vary": "Accept-Encoding, Accept, X-Requested-With",
  "x-content-type-options": "nosniff",
  "x-frame-options": "deny",
  "x-github-media-type": "github.v3; format=json",
  "x-oauth-scopes": "repo",
  "x-xss-protection": "1; mode=block",
  "date": "Mon, 22 Nov 2021 12:02:16 GMT",
  "x-github-request-id": "C18F:0619:45DE5C:6AE72A:619B86C8",
  "connection": "close"
}
    at createHttpError (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:30:10)
    at IncomingMessage.<anonymous> (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:197:13)
    at IncomingMessage.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Error #4 --------------------------------------------------------------------------------
Error: socket hang up
    at connResetException (node:internal/errors:691:14)
    at TLSSocket.socketOnEnd (node:_http_client:471:23)
    at TLSSocket.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)  failedTask=build stackTrace=Error: Cannot cleanup: 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Error #1 --------------------------------------------------------------------------------
TypeError: Request path contains unescaped characters
    at new NodeError (node:internal/errors:371:5)
    at new ClientRequest (node:_http_client:154:13)
    at request (node:https:353:10)
    at NodeHttpExecutor.createRequest (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util/src/nodeHttpExecutor.ts:9:72)
    at /Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:111:28
    at /Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/CancellationToken.ts:83:7
    at new Promise (<anonymous>)
    at CancellationToken.createPromise (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/CancellationToken.ts:62:12)
    at NodeHttpExecutor.doApiRequest (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:110:30)
    at GitHubPublisher.doUploadFile (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/electron-publish/src/gitHubPublisher.ts:182:8)
    at Timeout._onTimeout (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/electron-publish/src/gitHubPublisher.ts:210:20)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Error #2 --------------------------------------------------------------------------------
Error: socket hang up
    at connResetException (node:internal/errors:691:14)
    at TLSSocket.socketOnEnd (node:_http_client:471:23)
    at TLSSocket.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Error #3 --------------------------------------------------------------------------------
HttpError: 422 Unprocessable Entity
"method: POST url: https://uploads.github.com/repos/toimc/electron-vite-demo-lesson/releases/53832696/assets?name=vite-electron-builder-21.11.22-703.dmg.blockmap\n\n          Data:\n          {\"message\":\"Validation Failed\",\"request_id\":\"C18F:0619:45DE5C:6AE72A:619B86C8\",\"documentation_url\":\"https://docs.github.com/rest\",\"errors\":[{\"resource\":\"ReleaseAsset\",\"code\":\"already_exists\",\"field\":\"name\"}]}\n          "
Headers: {
  "cache-control": "no-cache",
  "content-length": "208",
  "content-security-policy": "default-src 'none'",
  "content-type": "application/json; charset=utf-8",
  "strict-transport-security": "max-age=31557600",
  "vary": "Accept-Encoding, Accept, X-Requested-With",
  "x-content-type-options": "nosniff",
  "x-frame-options": "deny",
  "x-github-media-type": "github.v3; format=json",
  "x-oauth-scopes": "repo",
  "x-xss-protection": "1; mode=block",
  "date": "Mon, 22 Nov 2021 12:02:16 GMT",
  "x-github-request-id": "C18F:0619:45DE5C:6AE72A:619B86C8",
  "connection": "close"
}
    at createHttpError (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:30:10)
    at IncomingMessage.<anonymous> (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util-runtime/src/httpExecutor.ts:197:13)
    at IncomingMessage.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Error #4 --------------------------------------------------------------------------------
Error: socket hang up
    at connResetException (node:internal/errors:691:14)
    at TLSSocket.socketOnEnd (node:_http_client:471:23)
    at TLSSocket.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
    at throwError (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util/src/asyncTaskManager.ts:88:11)
    at checkErrors (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util/src/asyncTaskManager.ts:53:9)
    at AsyncTaskManager.awaitTasks (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util/src/asyncTaskManager.ts:67:7)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at PublishManager.awaitTasks (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/app-builder-lib/src/publish/PublishManager.ts:232:5)
    at Object.executeFinally (/Users/runner/work/electron-vite-demo-lesson/electron-vite-demo-lesson/node_modules/builder-util/src/promise.ts:23:3)
/Users/runner/work/_actions/samuelmeuli/action-electron-builder/v1/index.js:144
                throw err;
                ^

Error: Command failed: npx --no-install electron-builder --mac --publish always --config electron-builder.config.js
    at checkExecSyncError (child_process.js:621:11)
    at execSync (child_process.js:657:15)
    at run (/Users/runner/work/_actions/samuelmeuli/action-electron-builder/v1/index.js:21:27)
    at runAction (/Users/runner/work/_actions/samuelmeuli/action-electron-builder/v1/index.js:132:4)
    at Object.<anonymous> (/Users/runner/work/_actions/samuelmeuli/action-electron-builder/v1/index.js:150:1)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 29081,
  stdout: null,
  stderr: null

Any sugguestion?

Thanks.

andirsun commented 2 years ago

I am using electron-notarize library instead on electron-builder-notarize, maybe can work for you aswell

- name: Build and Release App
        uses: CryogenicPlanet/action-electron-builder@v2 # Using CryogenicPlanet until the main action adds skip_install https://github.com/samuelmeuli/action-electron-builder/pull/60
        with:
          github_token: ${{ secrets.gh_token }}
          # Sign the code with apple developer certificates
          mac_certs: ${{ secrets.mac_certs }}
          mac_certs_password: ${{ secrets.mac_certs_password }}
          max_attempts: 2
          release: true
        env:
          # macOS notarization envs
          APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
          APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}