@@ -83,23 +83,105 @@ jobs:
8383 python:
8484 - 'python/**'
8585
86+ charts-tests :
87+ name : Charts tests
88+ needs : [changes]
89+ if : needs.changes.outputs.charts == 'true'
90+ uses : ./.github/workflows/charts_tests.yml
91+
92+ charts-release :
93+ name : Charts release
94+ needs : [charts-tests]
95+ if : needs.changes.outputs.charts == 'true'
96+ defaults :
97+ run :
98+ working-directory : ./charts
99+ runs-on : ubuntu-latest
100+ steps :
101+ - name : Checkout Repo
102+ uses : actions/checkout@v3
103+
104+ - name : Create new versions
105+ run : pnpm run version
106+ env :
107+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
108+
109+ - name : Release new versions
110+ uses : changesets/action@v1
111+ with :
112+ publish : pnpm run publish
113+ createGithubReleases : true
114+ env :
115+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
116+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
117+
118+
119+ build-docker-image :
120+ name : Build Docker Image
121+ runs-on : ubuntu-latest
122+ needs : [changes, charts-release]
123+ if : !cancelled() && needs.changes.outputs.template == 'true' || needs.changes.outputs.charts == 'true'
124+ steps :
125+ - name : Checkout repository
126+ uses : actions/checkout@v3
127+ with :
128+ fetch-depth : 0
129+
130+ - name : Set up Docker Buildx
131+ uses : docker/setup-buildx-action@v3
132+
133+ - name : Log in to DockerHub
134+ uses : docker/login-action@v3
135+ with :
136+ username : ${{ secrets.DOCKERHUB_USERNAME }}
137+ password : ${{ secrets.DOCKERHUB_TOKEN }}
138+
139+ - name : Build and push to DockerHub
140+ working-directory : ./template
141+ run : |
142+ docker pull ${{ secrets.DOCKERHUB_USERNAME }}/code-interpreter:latest || true
143+ docker buildx build \
144+ --file Dockerfile \
145+ --platform linux/amd64 \
146+ --push \
147+ --tag ${{ secrets.DOCKERHUB_USERNAME }}/code-interpreter:latest .
148+
149+ build-template :
150+ name : Build Docker Image
151+ runs-on : ubuntu-latest
152+ needs : [build-docker-image]
153+ if : !cancelled() && needs.changes.outputs.template == 'true' || needs.changes.outputs.charts == 'true'
154+ steps :
155+ - name : Checkout repository
156+ uses : actions/checkout@v3
157+ with :
158+ fetch-depth : 0
159+ - name : Install E2B CLI
160+ run : npm install -g @e2b/cli
161+
162+ - name : Build e2b
163+ run : e2b template build
164+ working-directory : ./template
165+ env :
166+ E2B_ACCESS_TOKEN : ${{ secrets.E2B_ACCESS_TOKEN }}
167+
86168 python-tests :
87169 name : Python Tests
88- needs : [changes]
89- if : needs.changes.outputs.python == 'true'
170+ needs : [changes, build-template ]
171+ if : !cancelled() && needs.changes.outputs.python == 'true' || needs.changes.outputs.template == 'true'
90172 uses : ./.github/workflows/python_tests.yml
91173 secrets : inherit
92174
93175 js-tests :
94176 name : JS Tests
95177 needs : [changes]
96- if : needs.changes.outputs.js == 'true'
178+ if : !cancelled() && needs.changes.outputs.js == 'true' || needs.changes.outputs.template == 'true'
97179 uses : ./.github/workflows/js_tests.yml
98180 secrets : inherit
99181
100182 release :
101183 needs : [python-tests, js-tests]
102- if : always () && !contains(needs.*.result, 'failure') && needs.is_release .outputs.release == 'true'
184+ if : !cancelled () && !contains(needs.*.result, 'failure') && ( needs.changes .outputs.js == 'true' || needs.changes.outputs.python == 'true')
103185 name : Release
104186 runs-on : ubuntu-latest
105187 steps :
0 commit comments