Skip to content

Commit 02b67d6

Browse files
committed
add env override for NEXT_PUBLIC_CB_ENVIRONMENT="prod"
1 parent 3dd2940 commit 02b67d6

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.github/workflows/sdk-release-build.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,31 @@ jobs:
3333
- name: Set environment variables
3434
env:
3535
SECRETS_CONTEXT: ${{ toJSON(secrets) }}
36+
ENV_OVERRIDES: ${{ inputs.env-overrides }}
3637
shell: bash
3738
run: |
3839
VAR_NAMES=$(bun scripts/generate-ci-env.js)
3940
echo "$SECRETS_CONTEXT" | jq -r --argjson vars "$VAR_NAMES" '
4041
to_entries | .[] | select(.key as $k | $vars | index($k)) | .key + "=" + .value
4142
' >> $GITHUB_ENV
4243
44+
# Set default environment variables
4345
echo "CODEBUFF_GITHUB_ACTIONS=true" >> $GITHUB_ENV
46+
4447
echo "CODEBUFF_GITHUB_TOKEN=${{ secrets.CODEBUFF_GITHUB_TOKEN }}" >> $GITHUB_ENV
4548
49+
# Apply environment variable overrides
50+
if [ "$ENV_OVERRIDES" != "{}" ]; then
51+
echo "$ENV_OVERRIDES" | jq -r 'to_entries | .[] | .key + "=" + .value' >> $GITHUB_ENV
52+
fi
53+
4654
- name: Build SDK
4755
run: |
4856
cd sdk
4957
bun run build:verify
5058
env:
5159
BUILD_VERSION: ${{ inputs.new-version }}
5260

53-
- name: Open interactive debug shell
54-
if: ${{ failure() }}
55-
uses: mxschmitt/action-tmate@v3
56-
timeout-minutes: 15 # optional guard
57-
5861
- name: Set up Node.js for npm publishing
5962
uses: actions/setup-node@v4
6063
with:

.github/workflows/sdk-release-prod.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,16 @@ jobs:
5353
echo "New production version: $NEW_VERSION"
5454
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
5555
56+
git stash
57+
5658
build-and-publish-sdk:
5759
needs: prepare-and-commit-prod
5860
uses: ./.github/workflows/sdk-release-build.yml
5961
with:
6062
new-version: ${{ needs.prepare-and-commit-prod.outputs.new_version }}
6163
artifact-name: updated-sdk-package
6264
checkout-ref: ${{ github.sha }}
65+
env-overrides: '{"NEXT_PUBLIC_CODEBUFF_BACKEND_URL": "manicode-backend.onrender.com", "NEXT_PUBLIC_CB_ENVIRONMENT": "prod"}'
6366
secrets: inherit
6467

6568
push-to-git:
@@ -80,7 +83,6 @@ jobs:
8083
8184
- name: Commit and push version bump
8285
run: |
83-
git stash
8486
git pull --rebase origin main
8587
git stash pop
8688
git add sdk/package.json

0 commit comments

Comments
 (0)