Repository navigation
Open
Labels
Description
Pre-flight checklist
- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project uses.
- I have searched the issue tracker for a bug that matches the one I want to file, without success.
Electron Forge version
6.0.0-beta.63
Electron version
v18.1.0
Operating system
All
Last known working Electron Forge version
No response
Expected behavior
See "Actual behavior" description
Actual behavior
In my forge.config.js config, following this doc https://js.electronforge.io/publisher/github/interfaces/publishergithubconfig#authtoken, I have:
publishers: [
{
name: '@electron-forge/publisher-github',
config: {
repository: {
owner: 'myaccount',
name: 'myrepo',
},
authToken: process.env.GITHUB_TOKEN,
draft: process.env.PUBLISHER_GITHUB_DRAFT,
prerelease: process.env.PUBLISHER_GITHUB_PRERELEASE,
},
},
],When I yarn publish in my CI, I have the error:
> Run yarn publish
yarn publish v1.22.1
[1/4] Bumping version...
info Current version: 0.0.1
[2/4] Logging in...
error No token found and can't prompt for login when running with --non-interactive.
info Visit https://yarnpkg.com/en/docs/cli/publish for documentation about this command.
Error: Process completed with exit code 1.
To fix, this issue I had to remove the authToken from the forge.config.js config:
publishers: [
{
name: '@electron-forge/publisher-github',
config: {
repository: {
owner: 'myaccount',
name: 'myrepo',
},
draft: process.env.PUBLISHER_GITHUB_DRAFT,
prerelease: process.env.PUBLISHER_GITHUB_PRERELEASE,
},
},
],and change the command run in CI with:
yarn electron-forge publish --auth-token=${GITHUB_TOKEN}which finally works as expected:
...
Making for the following targets: deb
- Making for target: deb - On platform: linux - For arch: x64
✔ Making for target: deb - On platform: linux - For arch: x64
- Resolving publish target: @electron-forge/publisher-github
✔ Resolving publish target: @electron-forge/publisher-github
- Searching for target release: 0.0.1
✔ Searching for target release: 0.0.1
- Uploading Artifacts 0/1 to v0.0.1
✔ Uploading Artifacts 1/1 to v0.0.1
Done in 74.63s.Steps to reproduce
See "Actual behavior" description
Additional information
No response
Reacted by Mariano Julio Vicario
Activity
fix: pass in auth token into the command
Mubramaj commentedon Oct 2, 2023
I think what is happening here is that the Github action is confused and the
yarn publishis trying actually to do the publishing of an npm package, that needs a specific token ( not the GITHUB_TOKEN of electron forge )What I did in my repo is that I replaced the package.json script
publishbypublish-app:Of course also updated my github action to run
yarn publish-appinstead ofyarn publish[-]publisher-github: Setting the `authToken` in the `forge.config.js` configuration doesn't work[/-][+]Rename `publish` command to avoid naming conflict with `yarn publish`[/+]erickzhao commentedon Feb 1, 2025
Another solution would just be to run
yarn run publish, but having this as the default command is confusing if you're used to runningyarnscripts directly.