diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1880fa08c..3fb0d8d01 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,13 +28,29 @@ jobs: echo "##[set-output name=tag;]$TAG" id: extract_branch - - name: Docker ECR - uses: kciter/aws-ecr-action@v2 + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@13d241b293754004c80624b5567555c4a39ffbe3 with: - access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} - secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - account_id: ${{ secrets.AWS_ACCOUNT_ID }} - region: eu-west-1 - repo: appq-register-page - tags: ${{ steps.extract_branch.outputs.tag }} - extra_build_args: --build-arg NPM_TOKEN=${{ secrets.NPM_TOKEN }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-west-1 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@aaf69d68aa3fb14c1d5a6be9ac61fe15b48453a2 + + - name: Build, tag, and push image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: appq-register-page + IMAGE_TAG: ${{ steps.extract_branch.outputs.tag }} + run: | + # Build a docker container and + # push it to ECR so that it can + # be deployed to ECS. + docker build \ + --build-arg NPM_TOKEN=${{ secrets.NPM_TOKEN }} \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"