Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not letting me push to github #3392

Closed
3 tasks done
securing-ab opened this issue Oct 28, 2023 · 1 comment
Closed
3 tasks done

Not letting me push to github #3392

securing-ab opened this issue Oct 28, 2023 · 1 comment

Comments

@securing-ab
Copy link

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

5.2.4

Electron version

v27.0.1

Operating system

Windows 11

Last known working Electron Forge version

No response

Expected behavior

Create a github release

Actual behavior

An unhandled rejection has occurred inside Forge:
Error: In order to publish to github you must set the "github_repository.owner" and "github_repository.name" properties in your Forge config. See the docs for more info
at PublisherGithub.publish (C:\Users\user\Documents\GitHub\desktop-app-code\node_modules@electron-forge\publisher-github\dist\PublisherGithub.js:30:19)
at Task.task (C:\Users\user\Documents\GitHub\desktop-app-code\node_modules@electron-forge\core\dist\api\publish.js:45:41)
at Task.run (C:\Users\user\Documents\GitHub\desktop-app-code\node_modules\listr2\dist\index.cjs:978:35)

Steps to reproduce

try pushing to github

Additional information

{
"name": "yuriz",
"version": "1.2.0-canary",
"description": "The official Yuriz app",
"main": "main.js",
"scripts": {
"start": "electron-forge start",
"make": "electron-forge make",
"publish": "electron-forge publish",
"build:canary": "electron-forge publish canary",
"build:beta": "electron-forge publish beta",
"build:latest": "electron-forge publish latest"
},
"author": "Yuriz",
"config": {
"forge": {
"packagerConfig": {
"asar": true,
"icon": "assets/icon.png",
"extraFiles": [
{
"from": "config.json",
"to": "resources/app"
}
]
},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "yuriz",
"icon": "assets/icon.ico"
}
}
],
"publishers": [
{
"name": "@electron-forge/publisher-github",
"config": {
"github_repository": {
"owner": "TeamRCD",
"name": "desktop-app"
},
"channels": {
"canary": {
"url": "https://github.com/TeamRCD/desktop-app/releases/tag/canary",
"name": "Canary"
},
"beta": {
"url": "https://github.com/TeamRCD/desktop-app/releases/tag/beta",
"name": "Beta"
},
"latest": {
"url": "https://github.com/TeamRCD/desktop-app/releases/tag/latest",
"name": "Latest"
}
}
}
}
]
}
},
"license": "CC0-1.0",
"devDependencies": {
"@electron-forge/cli": "^6.0.0",
"@electron-forge/maker-squirrel": "^6.4.2",
"@electron-forge/publisher-github": "^6.4.2",
"electron": "^27.0.1"
},
"dependencies": {
"@electron/remote": "^2.0.12",
"electron-is-dev": "^2.0.0",
"electron-log": "^4.4.8",
"electron-updater": "6.1.4",
"undici": "^5.26.4"
}
}

@erikian
Copy link
Member

erikian commented Oct 29, 2023

As described in the Github publisher documentation, the correct property name is repository, not github_repository, so your publishers object should look like this:

"publishers": [
  {
    "name": "@electron-forge/publisher-github",
    "config": {
      "repository": {
        "owner": "TeamRCD",
        "name": "desktop-app"
      },
      "channels": {
        "canary": {
          "url": "https://github.com/TeamRCD/desktop-app/releases/tag/canary",
          "name": "Canary"
        },
        "beta": {
          "url": "https://github.com/TeamRCD/desktop-app/releases/tag/beta",
          "name": "Beta"
        },
        "latest": {
          "url": "https://github.com/TeamRCD/desktop-app/releases/tag/latest",
          "name": "Latest"
        }
      }
    }
  }
]

The error message you got is wrong (our bad), I'll fix that to reflect the correct property that we're expecting.

As an aside, I recommend you move your Forge configuration from your package.json to the forge.config.ts file in your project root, this makes it easier to catch any configuration errors. Here's an example:

// forge.config.ts

import { PublisherGitHubConfig } from '@electron-forge/publisher-github';
import { ForgeConfig } from '@electron-forge/shared-types';

const forgeConfig: ForgeConfig = {
  packagerConfig: {
    asar: true,
    icon: 'assets/icon.png',
    extraFiles: [
      {
        from: 'config.json',
        to: 'resources/app',
      },
    ],
  },
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {
        name: 'yuriz',
        icon: 'assets/icon.ico',
      },
    },
  ],
  publishers: [
    {
      name: '@electron-forge/publisher-github',
      config: {
        repository: {
          owner: 'TeamRCD',
          name: 'desktop-app',
        },
        channels: {
          canary: {
            url: 'https://github.com/TeamRCD/desktop-app/releases/tag/canary',
            name: 'Canary',
          },
          beta: {
            url: 'https://github.com/TeamRCD/desktop-app/releases/tag/beta',
            name: 'Beta',
          },
          latest: {
            url: 'https://github.com/TeamRCD/desktop-app/releases/tag/latest',
            name: 'Latest',
          },
        },
      } as PublisherGitHubConfig,
    },
  ],
};

export default forgeConfig;



// package.json

{
  "name": "yuriz",
  "version": "1.2.0-canary",
  "description": "The official Yuriz app",
  "main": "main.js",
  "scripts": {
    "start": "electron-forge start",
    "make": "electron-forge make",
    "publish": "electron-forge publish",
    "build:canary": "electron-forge publish canary",
    "build:beta": "electron-forge publish beta",
    "build:latest": "electron-forge publish latest"
  },
  "author": "Yuriz",
  "license": "CC0-1.0",
  "devDependencies": {
    "@electron-forge/cli": "^6.0.0",
    "@electron-forge/maker-squirrel": "^6.4.2",
    "@electron-forge/publisher-github": "^6.4.2",
    "electron": "^27.0.1"
  },
  "dependencies": {
    "@electron/remote": "^2.0.12",
    "electron-is-dev": "^2.0.0",
    "electron-log": "^4.4.8",
    "electron-updater": "6.1.4",
    "undici": "^5.26.4"
  }
}

Note that you'll need to install ts-node as a dev dependency for the forge.config.ts file to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants