I have been trying to use codemagic to make a build of my React/Electron application for a Mac environment as my current development environment is Windows.
It almost gets through the build, but then it fails with this status code (1):
⨯ GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"
I've tried to set GH_TOKEN programmatically, as "process.env.GH_TOKEN=XXXX" where I've used my personal access token. I've tried adding it to my .env file, I've also tried to put it in the yaml file.
workflows:
macos-build:
name: macOS Build
instance_type: mac_pro
environment:
groups:
- prod
node: 16.14.0
scripts:
- name: Injecting env vars
script: echo "REACT_APP_API_KEY=$REACT_APP_API_KEY" >> .env
- name: Installing packages
script: yarn install
- name: Building Applications - React
script: GH_TOKEN=XXXXXX yarn build
- name: Building Application - Electron
script: yarn electron-builder -m -c.extraMetadata.main=build/electron.js
artifacts:
- out/make/*.dmg
I tried to add it as a single script as well, and I continue to get the error. The only time I don't get the error is if I add:
--publish=never
to the electron-builder tag. But then I am left with no artifact.
Can someone tell me what I'm doing wrong?
Thanks.