Merge pull request #202 from UKGovernmentBEIS/DineshKumarASD-patch-8 #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upload Release to ECR preprod | ||
#concurrency: upload_to_ecr | ||
on: | ||
release: | ||
branches: [ "*" ] | ||
types: | ||
- created | ||
jobs: | ||
upload: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.3] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
name: Upload new Release to ECR | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Configure AWS credentials in preprod | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PREPROD }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PREPROD }} | ||
aws-region: eu-west-2 | ||
- name: Login to ECR in preprod | ||
id: login-ecr | ||
uses: aws-actions/[email protected] | ||
- name: Build & Push Image to ECR in preprod | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: beis | ||
IMAGE_TAG: latest | ||
run: | | ||
docker build --no-cache -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg BUILD_NUMBER=${{ github.run_number }} --build-arg GIT_REF=$(git log -n 1 | awk '{print $2; exit}') . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
aws ecs update-service --force-new-deployment --service ecs_webserver --cluster ecs_webserver |