From 2df7830d564a7698bf393bce410142e99c72fa15 Mon Sep 17 00:00:00 2001 From: Giuseppe Nardiello Date: Thu, 14 Mar 2024 11:17:38 +0100 Subject: [PATCH] Fixed pipeline --- .github/workflows/main.yml | 76 +++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ebe8f0a..9ba92ad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,41 +1,41 @@ on: - push: - branches: [ dev, main ] - pull_request: - branches: [ dev, main ] - - name: AWS ECR push - - jobs: - deploy: - name: Deploy - runs-on: ubuntu-latest + push: + branches: [ dev, main ] + pull_request: + branches: [ dev, main ] - steps: - - name: Checkout - uses: actions/checkout@v4 +name: AWS ECR push - - 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: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v2 - - - name: Build, tag, and push the image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: "lexic/prod/vocbench-pps" - IMAGE_TAG: ${{ github.head_ref || github.ref_name }} - - run: | - # Build a docker container and push it to ECR - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . - echo "Pushing image to ECR..." - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" \ No newline at end of file +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - 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: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Build, tag, and push the image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: "lexic/prod/vocbench-pps" + IMAGE_TAG: ${{ github.head_ref || github.ref_name }} + + run: | + # Build a docker container and push it to ECR + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + echo "Pushing image to ECR..." + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" \ No newline at end of file