Selaa lähdekoodia

Fix CI

master
Palash Bansal 1 vuosi sitten
vanhempi
commit
4181aa9ec5
No account linked to committer's email address
2 muutettua tiedostoa jossa 11 lisäystä ja 1 poistoa
  1. 2
    0
      .github/workflows/deploy-pages.yml
  2. 9
    1
      scripts/generate-example-env.mjs

+ 2
- 0
.github/workflows/deploy-pages.yml Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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)

Loading…
Peruuta
Tallenna