Palash Bansal před 1 rokem
rodič
revize
4181aa9ec5
Žádný účet není propojen s e-mailovou adresou tvůrce revize

+ 2
- 0
.github/workflows/deploy-pages.yml Zobrazit soubor

@@ -44,6 +44,8 @@ jobs:
cache-dependency-path: '**/package-lock.json' # https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data
- run: npm ci # this will also run `npm run prepare` which will build # todo use --cache .npm
- run: npm run build-site # builds to _site
env:
DOT_ENV_CONTENT: ${{ secrets.examples_dot_env }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:

+ 9
- 1
scripts/generate-example-env.mjs Zobrazit soubor

@@ -7,13 +7,21 @@ if (fs.existsSync(envFilePath)) {
dotenv.config({ path: envFilePath })
}

// Parse DOT_ENV_CONTENT environment variable as .env file if it exists(for ci)
if (process.env.DOT_ENV_CONTENT) {
const envConfig = dotenv.parse(process.env.TP_EX)
for (const key in envConfig) {
process.env[key] = envConfig[key]
}
}

// Filter EX_ variables from environment
const envVars = Object.entries(process.env)
.filter(([key]) => key.startsWith('TP_EX_'))
.reduce((acc, [key, value]) => {
acc[key.replace('TP_EX_', '')] = value
return acc
}, {})
}, {'DUMMY': '1'}) // dummy to prevent empty file which is not a module apparently

// Generate globals.js
const jsOutput = Object.entries(envVars)

Načítá se…
Zrušit
Uložit