electron / electron/forge

Rename `publish` command to avoid naming conflict with `yarn publish`

Open
#2,820 2 comments 1 reaction 0 assignees View on GitHub
publisher
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [X] I have read the [contribution documentation](https://github.com/electron-userland/electron-forge/blob/master/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [X] 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:

```js
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:
```js
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:
```bash
yarn electron-forge publish --auth-token=${GITHUB_TOKEN}
```

which finally works as expected:
```bash
...
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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.