2
votes
  • Electron-builder Version: 20.38.5
  • Target: Windows ia32 and x64

I'm trying to push the project to GitHub releases in a private repository. The main target is Win ia32 and x64.

I set the token in the console by:

set GH_TOKEN=<blabla>

And at the package.json file:

"publish": {
      "provider": "github",
      "repo": "electron-todo-tasks",
      "owner": "AndreD23",
      "host": "github.com",
      "protocol": "https",
      "releaseType": "draft",
      "token": "<blablabla>",
      "private": true
    }

I'm the only one who will have access to the project, so updating the token in the file apparently not a problem.

But, when I run:

electron-builder --x64 --ia32 --publish always

It shows me the error:

Error: Cannot cleanup:

Error #1 --------------------------------------------------------------------------------
HttpError: 404 Not Found
"method: undefined url: https://github.com/repos/AndreD23/electron-todo-tasks/releases\n\nPlease double check that your authentication token is correct. Due to security reasons actual status maybe not reported, but 404.\n"

I'll attach the whole error.

2019-03-22T13_04_27_992Z-debug.log

electron publish error.txt

I tried to change the option always to onTag or onTagOrDraft and change releaseType to release.

I tried to manually create a draft on GitHub first, doesn't work.

I tried to make the repository public for tests, not working too.

I tried to regenerate the token twice and updated the envs, console and package.json, doesn't work.

Is there any configuration that I've missed? What I have to do for Electron to publish to GitHub?

At the error, it says that cannot find https://github.com/repos/AndreD23/electron-todo-tasks/releases. Opening it on the web browser, it returns 404. I find the link a bit strange because it adds the word repos after github.com, and removing it in the browser it loads fine. This word is setting automatically?

2

2 Answers

2
votes

Thanks @edelCustodio

Reference: https://github.com/electron-userland/electron-builder/issues/3776#issuecomment-486888574

This worked for me, on PowerShell type this

[Environment]::SetEnvironmentVariable("GH_TOKEN","my-personal-token","User") 

and be sure that you package.json will be like this:

"build": {
    "appId": "com.friasoftit.electron-auto-update",
    "productName": "Electron Auto Update",
    "publish": [
      {
        "provider": "github",
        "owner": "edelCustodio",
        "repo": "electron-auto-update"
      }
    ],
    "win": {
      "publish": [
        "github"
      ],
      "target": [
        {
          "target": "nsis",
          "arch": [
            "x64",
            "ia32"
          ]
        }
      ]
    }
  },

And then I run this command yarn run publish and this is how my publish is on my package.json

"publish": "build --win -p always" 

Don't forget to close and open a new PowerShell terminal.

0
votes
  1. Run windows powerShell from Administrator
  2. Execute [Environment]::SetEnvironmentVariable("GH_TOKEN","<git_hub_token>","User")
  3. Launch or full restart your IDE
  4. Run bozon package windows --publish

Config:

{
  "name": "",
  "version": "",
  "description": "",
  "author": "",
  "repository": "<repo_url>",
  "dependencies": {
    "cross-fetch": "^3.0.6",
    "electron-builder": "^22.10.5",
    "file-loader": "^6.2.0",
    "luxon": "^1.26.0",
    "node-fetch": "^2.6.1"
  },
  "license": "ISC",
  "devDependencies": {
    "bozon": "1.1.3",
    "eslint-config-airbnb-base": "^14.2.1",
    "eslint-plugin-import": "^2.22.1",
    "jest": "26.6.3",
    "spectron": "13.0.0"
  },
  "build": {
    "appId": "",
    "publish": [
      {
        "provider": "github"
      }
    ],
    "win": {}
  },
  "main": ".eslintrc.js",
  "directories": {
    "test": "test"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  }
}