title: How to read from .env file in electron-builder yaml config file?
body: <p>I am new to electron. I have an angular application wrapped in electron that I want to build the package/installer using <code>electron-builder</code>. I am using <code>electron-builder-config.yaml</code> file to build the installer.</p>
  <p>I would like to know how do I read values from <code>.env</code> environment file into <code>electron-builder-config.yaml</code> file ?</p>
  <p>I want to set the version of the package that is generated by command <code>electron-builder -w --publish always -c ./builder-config.yaml</code>.</p>
  <p>I did try using <code>buildVersion</code> property but the problem is that there is an <code>installer.nsh</code> file that needs to run as part of nsis installer to set the path and that file uses <code>${version}</code>.</p>
  <p>There is very little <a href="https://www.electron.build/configuration/configuration.html#environment-variables-from-file" rel="nofollow noreferrer">documentation</a> on environment variables usage in electron-builder-config.yaml</p>
  <p>Here is my <code>electron-builder-config.yaml</code></p>
  <pre><code>directories:
    output: ./dist/electron
    buildResources: ./electron/build
    app: ''
  electronVersion: X.Y.Z
  appId:  com.sample.app
  copyright: &quot;Copyright © 2020 ${author}&quot;
  productName: TestApp
  forceCodeSigning: true
  artifactName: &quot;${productName}-${os}-${version}.${ext}&quot;
  files:
    - &quot;**/dist/electron/*&quot;
    - &quot;**/electron/*&quot;
  asar: true
  compression: maximum
  mac:
    category: public.app-category.reference
    icon: &quot;./icon-file.icns&quot;
    publish: [{
        &quot;provider&quot;: &quot;generic&quot;,
        &quot;url&quot;: &quot;http://localhost:8080&quot;
    }]
  dmg:
    background: &quot;./build/sample.jpg&quot;
    icon: &quot;./build/nw.icns&quot;
    iconSize: 96
    contents:
      - x: 650
        y: 230
        type: link
        path: /Applications
      - x: 350
        y: 230
        type: file
  win:
    cscLink: &quot;./somelink.pfx&quot;
    cscKeyPassword: &quot;XXXXXX&quot;
    target: [nsis]
    icon: &quot;./appinfo.ico&quot;
    publish: [{
        &quot;provider&quot;: &quot;generic&quot;,
        &quot;url&quot;: &quot;http://localhost:8080&quot;
    }]
  msi:
    shortcutName: &quot;TestApp - ${version}&quot;
    createDesktopShortcut: true
    createStartMenuShortcut: true
  nsis:
    include: &quot;./installer.nsh&quot;
    installerIcon: &quot;./appinfo.ico&quot;
    uninstallerIcon: &quot;./appinfo.ico&quot;
    packElevateHelper: true
    allowToChangeInstallationDirectory: true
    perMachine: true
    oneClick: false
    createDesktopShortcut: true
    createStartMenuShortcut: true
    shortcutName: &quot;TestApp - ${version}&quot;
    guid: &quot;someguid&quot;
  npmRebuild: true
  nodeGypRebuild: false
  </code></pre>
  <p>Also, I am not sure about the macro <code>${ext}</code>. From where does this <code>electron-builder-config.yaml</code> file is picking up this value ? Even in the <a href="https://www.electron.build/file-patterns#file-macros" rel="nofollow noreferrer">documentation for file-macros</a>, the version does not have the clear definition.  Any suggestions ?</p>