Skip to content

Commit

Permalink
try vars_sec to .env file
Browse files Browse the repository at this point in the history
  • Loading branch information
nischalstha9 committed Sep 4, 2024
1 parent d1da970 commit d3f21cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ on:
workflow_dispatch:

jobs:
backend-build:
uses: hotosm/gh-workflows/.github/workflows/[email protected]
with:
context: .
build_target: prod
image_name: ghcr.io/${{ github.repository }}/backend
dockerfile: Dockerfile
secrets: inherit
# backend-build:
# uses: hotosm/gh-workflows/.github/workflows/[email protected]
# 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
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/frontend-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d3f21cd

Please sign in to comment.