diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index e6e5a3dc1..4f1de9160 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -2,59 +2,22 @@ on: push: branches: - main + - 'ci/update-workflow' tags: - - "v*" + - 'v*' paths: - - "backend/**" + - 'backend/**' workflow_dispatch: name: Build Docker image jobs: - build-docker-image: - name: Build Docker image - runs-on: ubuntu-latest - # These permissions are needed to interact with GitHub's OIDC Token endpoint. - permissions: - id-token: write - contents: read - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - role-to-assume: arn:aws:iam::166485377238:role/github-actions-onghub-ecr - aws-region: eu-west-1 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ steps.login-ecr.outputs.registry }}/teo - tags: | - type=edge - type=ref,event=branch - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v2 - - - name: Build and push - uses: docker/build-push-action@v3 - with: - context: backend - builder: ${{ steps.buildx.outputs.name }} - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + build: + name: Build Docker image + uses: code4romania/.github/.github/workflows/build-push-image-ecr.yml@main + with: + image_name: vic + region: eu-west-1 + secrets: + role_to_assume: ${{ secrets.ROLE_TO_ASSUME }}