karaggeorge / electron-builder-notarize

Notarize Electron applications using electron-builder
MIT License
80 stars 20 forks source link

is this possible to support .env as environment? #14

Open arvinxx opened 2 years ago

arvinxx commented 2 years ago

I want to add appid and appidpwd to my private repo by .env file.

# .env
APPLE_ID=xxx@xxx.com
APPLE_ID_PASSWORD=xxxx-xxxx-xxxx-xxxx

So it can be shared between my devices.

But it seems that it don't recognize .env file.

Is it possible to support .env file as environment?

karaggeorge commented 2 years ago

Yeah I can add a simple require('dotenv').config() at the top of the script. I probably won't have time to do this until the weekend. If you feel like opening a PR go for it 😄

arvinxx commented 2 years ago

@karaggeorge I open the pr #15 ,please check it~

Delagen commented 2 years ago

@arvinxx You can use env-cmd --file ./.env [command] simply as starter I use

env-cmd --file ./.env node ./package/builder.js

builder.js

const builder = require('electron-builder');
(async () => {
    try {
        await builder.build({config});
    } catch (exc) {
        console.error(exc);
        process.exit(1);
    }
})();

or .env-cmdrc

{
  "myconfig": {
    "APPLE_ID": "***",
    "APPLE_ID_PASSWORD": "***",
    "CSC_NAME": "*** OOO (***)",
    "TEAM_SHORT_NAME": "***"
  }
}

with

env-cmd --environments myconfig

You even can mix this

env-cmd --file ./.env env-cmd --environments myconfig
andirsun commented 2 years ago

Now its implemented on version 1.5.0

Nantris commented 2 years ago

I haven't gotten this working even in 1.5.0.

Oops. Don't export APPLE_ID=XXXX like you would to source the .env - Just APPLE_ID=XXXX.