Skip to content

Commit

Permalink
Merge pull request #21 from 0xPolygon/SPEC-269-build-params-for-nextjs
Browse files Browse the repository at this point in the history
Fix for deployment using github secrets for nextjs
  • Loading branch information
sshrihar authored Oct 24, 2024
2 parents c078d30 + b2344c9 commit 5ade387
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/ecs_deploy_docker_taskdef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ on:
required: false
default: "staging"
type: string

secrets:
build_params_gh_secret_keys:
required: false
description: "Pass github secrets in json format for supporting docker build"


jobs:
deploy_workflow:
Expand Down Expand Up @@ -64,6 +68,19 @@ jobs:
fetch-depth: 0
path: ./code

- name: Set up secrets
run: |
if [ -n "${{ secrets.build_params_gh_secret_keys }}" ]; then
echo "${{ secrets.build_params_gh_secret_keys }}" > secrets.json
fi
- name: Parse secrets and set environment variables
run: |
if [ -f secrets.json ]; then
echo "Setting environment variables from JSON..."
jq -r 'to_entries | .[] | "\(.key)=\(.value)"' secrets.json >> $GITHUB_ENV
fi
- name: Set variables
run: |
if [ "${{ inputs.taskdef_file_script }}" == "local" ]; then
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/npm_build_deploy_default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ on:
environment:
required: false
default: "staging"
type: string
type: string
secrets:
build_params_gh_secret_keys:
required: false
description: "Pass github secrets in json format for supporting docker build"

jobs:
deploy_workflow:
Expand Down Expand Up @@ -52,6 +56,19 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 20.9.0

- name: Set up secrets
run: |
if [ -n "${{ secrets.build_params_gh_secret_keys }}" ]; then
echo "${{ secrets.build_params_gh_secret_keys }}" > secrets.json
fi
- name: Parse secrets and set environment variables
run: |
if [ -f secrets.json ]; then
echo "Setting environment variables from JSON..."
jq -r 'to_entries | .[] | "\(.key)=\(.value)"' secrets.json >> $GITHUB_ENV
fi
- name: INSTALL
run: npm install
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vscode/*
*.pyc
*.pyc
.idea

0 comments on commit 5ade387

Please sign in to comment.