Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 1 addition & 79 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,84 +123,6 @@ jobs:
build-args: |
PRETIX_IMAGE=${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.eu-central-1.amazonaws.com/pythonit/pretix:pretix-base-${{ steps.git.outputs.githash }}

build-and-push-service:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

strategy:
fail-fast: false
matrix:
service:
- name: pycon-backend
dir: backend

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.aws_access_key_id }}
aws-secret-access-key: ${{ secrets.aws_secret_access_key }}
aws-region: eu-central-1
- name: Get service githash
id: git
run: |
hash=$(git rev-list -1 HEAD -- ${{ matrix.service.dir }})
echo "githash=$hash" >> $GITHUB_OUTPUT
- name: Check if commit is already on ECR
id: image
run: |
set +e
aws ecr describe-images --repository-name=pythonit/${{ matrix.service.name }} --image-ids=imageTag=${{ steps.git.outputs.githash }}
if [[ $? == 0 ]]; then
echo "image_exists=1" >> $GITHUB_OUTPUT
else
echo "image_exists=0" >> $GITHUB_OUTPUT
fi
- name: Set up QEMU dependency
if: ${{ steps.image.outputs.image_exists == 0 }}
uses: docker/setup-qemu-action@v3
- name: Login to GitHub Packages
if: ${{ steps.image.outputs.image_exists == 0 }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Amazon ECR
if: ${{ steps.image.outputs.image_exists == 0 }}
uses: aws-actions/amazon-ecr-login@v2
- name: Set up Docker Buildx
id: buildx
if: ${{ steps.image.outputs.image_exists == 0 }}
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
if: ${{ steps.image.outputs.image_exists == 0 }}
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.service.name }}
- name: Build and push
if: ${{ steps.image.outputs.image_exists == 0 }}
uses: docker/build-push-action@v6
with:
context: ./${{ matrix.service.dir }}
file: ./${{ matrix.service.dir }}/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
provenance: false
push: true
tags: |
${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.eu-central-1.amazonaws.com/pythonit/${{ matrix.service.name }}:${{ steps.git.outputs.githash }}
ghcr.io/pythonitalia/pycon/${{ matrix.service.name }}:${{ steps.git.outputs.githash }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
platforms: linux/amd64

build-and-push-arm-service:
runs-on: [self-hosted]
permissions:
Expand Down Expand Up @@ -274,7 +196,7 @@ jobs:

terraform:
runs-on: ubuntu-latest
needs: [build-and-push-service, build-and-push-arm-service, build-pretix, create-db]
needs: [build-and-push-arm-service, build-pretix, create-db]
environment:
name: ${{ fromJSON('["pastaporto", "production"]')[github.ref == 'refs/heads/main'] }}
defaults:
Expand Down