From 8f6b8da534e0edb933f193c3b82e943a39d39767 Mon Sep 17 00:00:00 2001 From: David Mears Date: Fri, 2 Aug 2024 16:17:07 +0100 Subject: [PATCH] Use script for env vars for github actions --- .github/workflows/playwright.yml | 9 +++------ scripts/ci/copy-env-vars-to-dot-env-file | 5 +++++ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100755 scripts/ci/copy-env-vars-to-dot-env-file diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index cb3c9589..5629258f 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -13,16 +13,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Set environment variables for app (todo - make into a script) - run: echo "NUXT_PUBLIC_R_API_BASE=$NUXT_PUBLIC_R_API_BASE" > .env + - name: Set environment variables for app + run: scripts/ci/copy-env-vars-to-dot-env-file env: NUXT_PUBLIC_R_API_BASE: ${{ vars.NUXT_PUBLIC_R_API_BASE }} - - name: print env vars - run: printenv | sort + # Note - non-secret variables are stored under the 'vars' context, while secrets will be stored under the 'secrets' context - name: print dot env file run: cat .env - - name: Setup upterm session (for ssh-ing) - uses: lhotari/action-upterm@v1 - name: Set up Node uses: actions/setup-node@v4 with: diff --git a/scripts/ci/copy-env-vars-to-dot-env-file b/scripts/ci/copy-env-vars-to-dot-env-file new file mode 100755 index 00000000..f6b52ef8 --- /dev/null +++ b/scripts/ci/copy-env-vars-to-dot-env-file @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +echo "NUXT_PUBLIC_R_API_BASE=$NUXT_PUBLIC_R_API_BASE" > .env