Merge pull request #42 from Tusharmahajan12/new_aspsep12 #5
Workflow file for this run
This file contains hidden or 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: PROD-NOTIFICATION-TAG-BASE-DEPLOYMENT | |
| on: | |
| push: | |
| tags: | |
| - 'al-v*' | |
| env: | |
| ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_AL }} | |
| EKS_CLUSTER_NAME: ${{ secrets.EKS_CLUSTER_NAME_PROD_AL }} | |
| AWS_REGION: ${{ secrets.AWS_REGION_NAME_AL }} | |
| jobs: | |
| NOTIFICATION-TAG-BASE-DEPLOYMENT-PROD: | |
| name: Deployment | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set TAG environment variable | |
| run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
| - name: Debug TAG value | |
| run: echo "TAG value - ${{ env.TAG }}" | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_AL }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_AL }} | |
| aws-region: ${{ env.AWS_REGION }} | |
| - name: Setup Node Env | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 21.1.0 | |
| - name: Show PWD and list content and Latest 3 commits | |
| run: | | |
| echo "Fetching all branches to ensure complete history" | |
| git fetch --all | |
| echo "Checking out the current branch" | |
| git checkout ${{ github.ref_name }} | |
| echo "Git Branch cloned" | |
| git branch | |
| echo "Current 3 merge commits are:" | |
| git log --merges -n 3 | |
| pwd | |
| ls -ltra | |
| - name: Login to Amazon ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v1 | |
| - name: Build, tag, and push image to Amazon ECR | |
| env: | |
| ECR_REGISTRY: ${{ secrets.ECR_REPOSITORY_AL }} | |
| IMAGE_TAG: ${{ env.TAG }} | |
| run: | | |
| docker build -t ${{ secrets.ECR_REPOSITORY_AL }}:${{ env.TAG }} . | |
| docker push ${{ secrets.ECR_REPOSITORY_AL }}:${{ env.TAG }} | |
| - name: Update kube config | |
| run: aws eks update-kubeconfig --name ${{ secrets.EKS_CLUSTER_NAME_PROD_AL }} --region ${{ secrets.AWS_REGION_NAME_AL }} | |
| - name: Deploy to EKS | |
| env: | |
| ECR_REGISTRY: ${{ secrets.ECR_REPOSITORY_AL }} | |
| IMAGE_TAG: ${{ env.TAG }} | |
| run: | | |
| export ECR_REPOSITORY=${{ secrets.ECR_REPOSITORY_AL }} | |
| export IMAGE_TAG=${{ env.TAG }} | |
| envsubst < manifest/notification-service.yaml > manifest/notification-service-updated.yaml | |
| cat manifest/notification-service-updated.yaml | |
| rm -rf manifest/notification-service.yaml | |
| kubectl apply -f manifest/notification-service-updated.yaml -n prod | |
| sleep 10 | |
| kubectl get pods -n prod | |