Skip to content

Commit f93189b

Browse files
Add target env selection to prod build workflow (#228)
Co-authored-by: Matt Brockman <matt.brockman@e2b.dev>
1 parent 42985a3 commit f93189b

2 files changed

Lines changed: 65 additions & 5 deletions

File tree

.github/workflows/build_prod_template.yml

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,23 @@ name: Build Prod Template
33
on:
44
workflow_dispatch:
55
inputs:
6+
target_environment:
7+
description: Target environment
8+
required: true
9+
type: choice
10+
default: foxtrot
11+
options:
12+
- foxtrot
13+
- staging
14+
- juliett
615
skip_cache:
716
description: Skip build cache
817
required: false
918
type: boolean
1019
default: false
1120

1221
concurrency:
13-
group: Release-${{ github.ref }}
22+
group: Release-${{ github.ref }}-${{ inputs.target_environment }}
1423
cancel-in-progress: false
1524

1625
permissions:
@@ -33,18 +42,69 @@ jobs:
3342

3443
- uses: actions/setup-python@v6
3544
with:
36-
python-version: '${{ env.TOOL_VERSION_PYTHON }}'
45+
python-version: '${{ env.TOOL_VERSION_PYTHON }}'
3746

3847
- name: Install development dependencies
3948
working-directory: ./template
4049
run: pip install -r requirements-dev.txt
4150

51+
- name: Resolve target environment
52+
env:
53+
TARGET_ENVIRONMENT: ${{ inputs.target_environment }}
54+
FOXTROT_DOMAIN: ${{ vars.E2B_DOMAIN }}
55+
FOXTROT_API_KEY: ${{ secrets.E2B_PROD_API_KEY }}
56+
STAGING_API_KEY: ${{ secrets.E2B_STAGING_API_KEY }}
57+
JULIETT_API_KEY: ${{ secrets.E2B_JULIETT_API_KEY }}
58+
run: |
59+
set -eu
60+
61+
case "$TARGET_ENVIRONMENT" in
62+
foxtrot)
63+
E2B_DOMAIN="$FOXTROT_DOMAIN"
64+
E2B_API_KEY="$FOXTROT_API_KEY"
65+
;;
66+
staging)
67+
E2B_DOMAIN="e2b-staging.dev"
68+
E2B_API_KEY="$STAGING_API_KEY"
69+
;;
70+
juliett)
71+
E2B_DOMAIN="e2b-juliett.dev"
72+
E2B_API_KEY="$JULIETT_API_KEY"
73+
;;
74+
*)
75+
echo "Unknown target environment: $TARGET_ENVIRONMENT" >&2
76+
exit 1
77+
;;
78+
esac
79+
80+
if [ -z "$E2B_DOMAIN" ]; then
81+
echo "Missing E2B domain for target environment: $TARGET_ENVIRONMENT" >&2
82+
exit 1
83+
fi
84+
85+
if [ -z "$E2B_API_KEY" ]; then
86+
echo "Missing API key secret for target environment: $TARGET_ENVIRONMENT" >&2
87+
exit 1
88+
fi
89+
90+
echo "::add-mask::$E2B_API_KEY"
91+
92+
{
93+
echo "E2B_DOMAIN=$E2B_DOMAIN"
94+
echo "E2B_API_KEY=$E2B_API_KEY"
95+
} >> "$GITHUB_ENV"
96+
97+
{
98+
echo "### Build target"
99+
echo
100+
echo "Target: $TARGET_ENVIRONMENT"
101+
echo "Domain: $E2B_DOMAIN"
102+
} >> "$GITHUB_STEP_SUMMARY"
103+
42104
- name: Build E2B template
43105
id: build-template
44106
working-directory: ./template
45107
run: |
46108
python build_prod.py
47109
env:
48-
E2B_API_KEY: ${{ secrets.E2B_PROD_API_KEY }}
49-
E2B_DOMAIN: ${{ vars.E2B_DOMAIN }}
50110
SKIP_CACHE: ${{ inputs.skip_cache }}

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77

8-
concurrency: ${{ github.workflow }}-${{ github.ref }}
8+
concurrency: Release-${{ github.ref }}-foxtrot
99

1010
permissions:
1111
id-token: write

0 commit comments

Comments
 (0)