Deploy-Dev2 #365
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: Deploy-Dev2 | |
| on: | |
| workflow_run: | |
| workflows: | |
| - DEV2-CI | |
| types: | |
| - completed | |
| env: | |
| IMAGE_ID: ${{ secrets.AWS_ECR_URI }} | |
| TF_VERSION: 1.0.5 | |
| TG_VERSION: 0.31.4 | |
| TG_SRC_PATH: terraform | |
| TFC_WORKSPACE: dev2 | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| # automated deployment to DEV2 | |
| cd: | |
| name: cd | |
| runs-on: ubuntu-22.04 | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v2 | |
| with: | |
| ref: ${{ github.event.workflow_run.head_branch }} | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_USE_DEV }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Update Kubeconfig | |
| run: | | |
| aws eks update-kubeconfig --name workbc-cluster2 --region ${{ secrets.AWS_REGION }} | |
| - name: Set image on Kubernetes deployment | |
| env: | |
| IMAGE: ${{ secrets.AWS_ECR_URI }}:${{ github.event.workflow_run.head_sha }} | |
| run: | | |
| kubectl delete job drupal-drush-workbc2 -n app --ignore-not-found | |
| sed "s|__IMAGE__|$IMAGE|g" yaml/drush2.yaml | kubectl apply -f - | |
| kubectl wait --for=condition=complete job/drupal-drush-workbc2 --timeout=600s -n app | |
| kubectl set image deployment/workbc2 drupal=$IMAGE --namespace=app | |