update .env writing
This commit is contained in:
@@ -25,10 +25,14 @@ jobs:
|
||||
|
||||
- name: Create production .env file
|
||||
working-directory: electron-app
|
||||
run: |
|
||||
echo "WS_URL=${{ secrets.WS_URL }}" > .env
|
||||
echo "API_URL=${{ secrets.API_URL }}" >> .env
|
||||
echo "NODE_ENV=production" >> .env
|
||||
env:
|
||||
WS_URL: ${{ secrets.WS_URL }}
|
||||
API_URL: ${{ secrets.API_URL }}
|
||||
run: node scripts/create-env.cjs
|
||||
|
||||
- name: Verify .env file
|
||||
working-directory: electron-app
|
||||
run: type .env
|
||||
|
||||
- name: Build TypeScript
|
||||
working-directory: electron-app
|
||||
|
||||
14
electron-app/scripts/create-env.cjs
Normal file
14
electron-app/scripts/create-env.cjs
Normal file
@@ -0,0 +1,14 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const envPath = path.join(__dirname, '..', '.env');
|
||||
|
||||
const content = `WS_URL=${process.env.WS_URL || ''}
|
||||
API_URL=${process.env.API_URL || ''}
|
||||
NODE_ENV=production
|
||||
`;
|
||||
|
||||
fs.writeFileSync(envPath, content, 'utf8');
|
||||
console.log('.env file created at:', envPath);
|
||||
console.log('Contents:');
|
||||
console.log(content);
|
||||
Reference in New Issue
Block a user