@@ -46,13 +46,12 @@ jobs:
4646 fi
4747
4848 build-pretix :
49- name : Build pretix
50- runs-on : [self-hosted]
5149 needs : [check-pretix-build]
52- if : ${{ needs.check-pretix-build.outputs.image_exists == 0 }}
5350 uses : ./.github/workflows/build-pretix.yml
5451 with :
5552 githash : ${{ needs.check-pretix-build.outputs.githash }}
53+ secrets : inherit
54+ if : ${{ needs.check-pretix-build.outputs.image_exists == 0 }}
5655
5756 check-backend-build :
5857 name : Check backend needs building
@@ -88,37 +87,12 @@ jobs:
8887 fi
8988
9089 build-be :
91- name : Build backend
92- runs-on : [self-hosted]
9390 needs : [check-backend-build]
91+ uses : ./.github/workflows/build-backend.yml
92+ with :
93+ githash : ${{ needs.check-backend-build.outputs.githash }}
94+ secrets : inherit
9495 if : ${{ needs.check-backend-build.outputs.image_exists == 0 }}
95- steps :
96- - name : Configure AWS credentials
97- uses : aws-actions/configure-aws-credentials@v4
98- with :
99- aws-access-key-id : ${{ secrets.aws_access_key_id }}
100- aws-secret-access-key : ${{ secrets.aws_secret_access_key }}
101- aws-region : eu-central-1
102- - name : Set up QEMU dependency
103- uses : docker/setup-qemu-action@v3
104- - name : Login to Amazon ECR
105- uses : aws-actions/amazon-ecr-login@v2
106- - name : Set up Docker Buildx
107- id : buildx
108- uses : docker/setup-buildx-action@v3
109- - name : Build and push
110- uses : docker/build-push-action@v6
111- with :
112- context : ./backend
113- file : ./backend/Dockerfile
114- builder : ${{ steps.buildx.outputs.name }}
115- provenance : false
116- push : true
117- tags : |
118- ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.eu-central-1.amazonaws.com/pythonit/pycon-backend:arm-${{ needs.check-backend-build.outputs.githash }}
119- cache-from : type=local,src=/tmp/.buildx-cache
120- cache-to : type=local,dest=/tmp/.buildx-cache
121- platforms : linux/arm64
12296
12397 deploy-be :
12498 name : Deploy backend
@@ -203,76 +177,12 @@ jobs:
203177 fi
204178
205179 build-fe :
206- name : Build frontend
207- needs : [wait-be-update, check-frontend-build]
208- runs-on : [self-hosted]
180+ needs : [check-frontend-build]
181+ uses : ./.github/workflows/build-frontend.yml
182+ with :
183+ githash : ${{ needs.check-frontend-build.outputs.githash }}
184+ secrets : inherit
209185 if : ${{ needs.check-frontend-build.outputs.image_exists == 0 }}
210- steps :
211- - uses : actions/checkout@v4
212- with :
213- ref : ${{ github.ref }}
214- fetch-depth : 0
215- - name : Configure AWS credentials
216- uses : aws-actions/configure-aws-credentials@v4
217- with :
218- aws-access-key-id : ${{ secrets.aws_access_key_id }}
219- aws-secret-access-key : ${{ secrets.aws_secret_access_key }}
220- aws-region : eu-central-1
221- - name : Get service githash
222- id : git
223- run : |
224- hash=$(git rev-list -1 HEAD -- frontend)
225- echo "githash=$hash" >> $GITHUB_OUTPUT
226- - name : Check if commit is already on ECR
227- id : image
228- run : |
229- set +e
230- aws ecr describe-images --repository-name=pythonit/${{ fromJSON('["pastaporto", "production"]')[github.ref == 'refs/heads/main'] }}-pycon-frontend --image-ids=imageTag=${{ steps.git.outputs.githash }}
231- if [[ $? == 0 ]]; then
232- echo "image_exists=1" >> $GITHUB_OUTPUT
233- else
234- echo "image_exists=0" >> $GITHUB_OUTPUT
235- fi
236- - name : Set up QEMU dependency
237- uses : docker/setup-qemu-action@v3
238- - name : Login to Amazon ECR
239- uses : aws-actions/amazon-ecr-login@v2
240- - name : Set up Docker Buildx
241- id : buildx
242- uses : docker/setup-buildx-action@v3
243- - name : Get vars
244- id : vars
245- run : |
246- cms_hostname=$(aws ssm get-parameter --output text --query Parameter.Value --with-decryption --name /pythonit/${{ env.TF_WORKSPACE }}/pycon-frontend/cms-hostname)
247- echo "CMS_HOSTNAME=$cms_hostname" >> "$GITHUB_OUTPUT"
248-
249- conference_code=$(aws ssm get-parameter --output text --query Parameter.Value --with-decryption --name /pythonit/${{ env.TF_WORKSPACE }}/pycon-frontend/conference-code)
250- echo "CONFERENCE_CODE=$conference_code" >> "$GITHUB_OUTPUT"
251-
252- sentry_auth_token=$(aws ssm get-parameter --output text --query Parameter.Value --with-decryption --name /pythonit/${{ env.TF_WORKSPACE }}/common/sentry-auth-token)
253- echo "::add-mask::$sentry_auth_token"
254- echo "SENTRY_AUTH_TOKEN=$sentry_auth_token" >> "$GITHUB_OUTPUT"
255- - name : Build and push
256- uses : docker/build-push-action@v6
257- with :
258- context : ./frontend
259- file : ./frontend/Dockerfile
260- builder : ${{ steps.buildx.outputs.name }}
261- provenance : false
262- push : true
263- tags : ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.eu-central-1.amazonaws.com/pythonit/${{ fromJSON('["pastaporto", "production"]')[github.ref == 'refs/heads/main'] }}-pycon-frontend:${{ steps.git.outputs.githash }}
264- cache-from : type=local,src=/tmp/.buildx-cache
265- cache-to : type=local,dest=/tmp/.buildx-cache
266- platforms : linux/arm64
267- build-args : |
268- API_URL_SERVER=https://${{ fromJSON('["pastaporto-", ""]')[github.ref == 'refs/heads/main'] }}admin.pycon.it
269- NEXT_PUBLIC_SITE_URL=${{ fromJSON('["pastaporto-frontend.", ""]')[github.ref == 'refs/heads/main'] }}pycon.it
270- CMS_ADMIN_HOST=${{ fromJSON('["pastaporto-", ""]')[github.ref == 'refs/heads/main'] }}admin.pycon.it
271- CMS_HOSTNAME=${{ steps.vars.outputs.cms_hostname }}
272- CONFERENCE_CODE=${{ steps.vars.outputs.conference_code }}
273- GIT_HASH=${{ steps.git.outputs.githash }}
274- secrets : |
275- "sentry_auth_token=${{ steps.vars.outputs.sentry_auth_token }}"
276186
277187 deploy-fe :
278188 name : Deploy frontend
@@ -300,7 +210,6 @@ jobs:
300210 - name : Terraform Validate
301211 id : validate
302212 run : terraform validate -no-color
303-
304213 - name : Terraform apply
305214 run : terraform apply -no-color -auto-approve &> /dev/null
306215 env :
0 commit comments