|
| 1 | +on: |
| 2 | + workflow_call: |
| 3 | + inputs: |
| 4 | + githash: |
| 5 | + required: true |
| 6 | + type: string |
| 7 | + tf_environment: |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build |
| 14 | + runs-on: [self-hosted] |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + ref: ${{ github.ref }} |
| 19 | + fetch-depth: 0 |
| 20 | + - name: Configure AWS credentials |
| 21 | + uses: aws-actions/configure-aws-credentials@v4 |
| 22 | + with: |
| 23 | + aws-access-key-id: ${{ secrets.aws_access_key_id }} |
| 24 | + aws-secret-access-key: ${{ secrets.aws_secret_access_key }} |
| 25 | + aws-region: eu-central-1 |
| 26 | + - name: Set up QEMU dependency |
| 27 | + uses: docker/setup-qemu-action@v3 |
| 28 | + - name: Login to Amazon ECR |
| 29 | + uses: aws-actions/amazon-ecr-login@v2 |
| 30 | + - name: Set up Docker Buildx |
| 31 | + id: buildx |
| 32 | + uses: docker/setup-buildx-action@v3 |
| 33 | + - name: Get vars |
| 34 | + id: vars |
| 35 | + run: | |
| 36 | + cms_hostname=$(aws ssm get-parameter --output text --query Parameter.Value --with-decryption --name /pythonit/${{ inputs.tf_environment }}/pycon-frontend/cms-hostname) |
| 37 | + echo "CMS_HOSTNAME=$cms_hostname" >> "$GITHUB_OUTPUT" |
| 38 | +
|
| 39 | + conference_code=$(aws ssm get-parameter --output text --query Parameter.Value --with-decryption --name /pythonit/${{ inputs.tf_environment }}/pycon-frontend/conference-code) |
| 40 | + echo "CONFERENCE_CODE=$conference_code" >> "$GITHUB_OUTPUT" |
| 41 | +
|
| 42 | + sentry_auth_token=$(aws ssm get-parameter --output text --query Parameter.Value --with-decryption --name /pythonit/${{ inputs.tf_environment }}/common/sentry-auth-token) |
| 43 | + echo "::add-mask::$sentry_auth_token" |
| 44 | + echo "SENTRY_AUTH_TOKEN=$sentry_auth_token" >> "$GITHUB_OUTPUT" |
| 45 | + - name: Build and push |
| 46 | + uses: docker/build-push-action@v6 |
| 47 | + with: |
| 48 | + context: ./frontend |
| 49 | + file: ./frontend/Dockerfile |
| 50 | + builder: ${{ steps.buildx.outputs.name }} |
| 51 | + provenance: false |
| 52 | + push: true |
| 53 | + tags: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.eu-central-1.amazonaws.com/pythonit/${{ inputs.tf_environment }}-pycon-frontend:${{ inputs.githash }} |
| 54 | + cache-from: type=local,src=/tmp/.buildx-cache |
| 55 | + cache-to: type=local,dest=/tmp/.buildx-cache |
| 56 | + platforms: linux/arm64 |
| 57 | + build-args: | |
| 58 | + API_URL_SERVER=https://${{ fromJSON('["pastaporto-", ""]')[github.ref == 'refs/heads/main'] }}admin.pycon.it |
| 59 | + NEXT_PUBLIC_SITE_URL=${{ fromJSON('["pastaporto-frontend.", ""]')[github.ref == 'refs/heads/main'] }}pycon.it |
| 60 | + CMS_ADMIN_HOST=${{ fromJSON('["pastaporto-", ""]')[github.ref == 'refs/heads/main'] }}admin.pycon.it |
| 61 | + CMS_HOSTNAME=${{ steps.vars.outputs.cms_hostname }} |
| 62 | + CONFERENCE_CODE=${{ steps.vars.outputs.conference_code }} |
| 63 | + GIT_HASH=${{ inputs.githash }} |
| 64 | + secrets: | |
| 65 | + "sentry_auth_token=${{ steps.vars.outputs.sentry_auth_token }}" |
0 commit comments