From d3f21cd1af7b9f37b055b5f697ee5fb4fb85156a Mon Sep 17 00:00:00 2001 From: Nischal Shrestha Date: Wed, 4 Sep 2024 15:45:30 +0545 Subject: [PATCH] try vars_sec to .env file --- .github/workflows/build_and_deploy.yml | 16 ++++++++-------- .github/workflows/frontend-build.yml | 12 +++--------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 6bbba0730e..e245ab0678 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -16,14 +16,14 @@ on: workflow_dispatch: jobs: - backend-build: - uses: hotosm/gh-workflows/.github/workflows/image_build.yml@2.0.5 - with: - context: . - build_target: prod - image_name: ghcr.io/${{ github.repository }}/backend - dockerfile: Dockerfile - secrets: inherit + # backend-build: + # uses: hotosm/gh-workflows/.github/workflows/image_build.yml@2.0.5 + # with: + # context: . + # build_target: prod + # image_name: ghcr.io/${{ github.repository }}/backend + # dockerfile: Dockerfile + # secrets: inherit frontend-build: uses: naxa-developers/tasking-manager/.github/workflows/frontend-build.yml@ci-gh-workflows diff --git a/.github/workflows/frontend-build.yml b/.github/workflows/frontend-build.yml index 1d5a421ae2..8b6c8418dc 100644 --- a/.github/workflows/frontend-build.yml +++ b/.github/workflows/frontend-build.yml @@ -106,15 +106,9 @@ jobs: SECRETS_CONTEXT: ${{ toJson(secrets) }} shell: bash run: | - to_envs() { jq -r "to_entries[] | \"\(.key)=\(.value)\""; } - - if [ "${VARS_CONTEXT}" != "null" ]; then - echo "${VARS_CONTEXT}" | to_envs > ${{ inputs.context }}/.env - fi - - if [ "${SECRETS_CONTEXT}" != "null" ]; then - echo "\n${SECRETS_CONTEXT}" | to_envs >> ${{ inputs.context }}/.env - fi + parsed_vars=$(jq -n --argjson VARS_CONTEXT "$VARS_CONTEXT" --argjson SECRETS_CONTEXT "$SECRETS_CONTEXT" "$VARS_CONTEXT+$SECRETS_CONTEXT") + to_envs() { jq -r "to_entries[] | \"\(.key)=\\\"\(.value)\\\"\n\""; } + echo "$parsed_vars" | to_envs > ${{ inputs.context }}/.env - id: build_frontend name: Build Frontend