Explorar el Código

Fix CI

master
Palash Bansal hace 1 año
padre
commit
4181aa9ec5
No account linked to committer's email address
Se han modificado 2 ficheros con 11 adiciones y 1 borrados
  1. 2
    0
      .github/workflows/deploy-pages.yml
  2. 9
    1
      scripts/generate-example-env.mjs

+ 2
- 0
.github/workflows/deploy-pages.yml Ver fichero

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

+ 9
- 1
scripts/generate-example-env.mjs Ver fichero

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


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

Cargando…
Cancelar
Guardar