name: OTA Portal Deploy on: push: branches: - main env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} SLACK_CHANNEL: "#cloud-builds" SLACK_FOOTER: "" SLACK_USERNAME: GitHub Actions SLACK_ICON: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" TAG: ${{ github.sha }} PROJECT: ota-admin-portal REGISTRY: fiskercloud.azurecr.io permissions: id-token: write contents: read jobs: build-dev: runs-on: ubuntu-latest steps: - name: Slack Notification uses: rtCamp/action-slack-notify@v2 - name: Checkout uses: actions/checkout@v4 - name: Azure Login uses: azure/login@v2 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Login to ACR uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ secrets.AZURE_CLIENT_ID }} password: ${{ secrets.AZURE_CLIENT_SECRET }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push DEV uses: docker/build-push-action@v5 with: context: . build-args: ENVIRONMENT=dev push: true tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-dev cache-from: type=gha cache-to: type=gha,mode=max - name: Notify if failure if: ${{ failure() }} uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ job.status }} SLACK_MESSAGE: "Failed to build ${{ env.PROJECT }} dev! :this-is-fine:" deploy-dev: needs: [build-dev] runs-on: [ arc-azure-dev ] environment: dev steps: - name: Checkout uses: actions/checkout@v4 - name: Notify deploy uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to dev... :partydeploy:" - name: Deploy to dev id: deploy uses: koslib/helm-eks-action@v1.28.0 env: KUBE_CONFIG_DATA: ${{ secrets.KUBECONFIG_AZURE_DEV }} with: command: | helm upgrade \ --atomic \ --create-namespace \ --namespace default \ --set image.registry=$REGISTRY \ --set image.name=$PROJECT \ --set image.tag=$TAG-dev \ --wait -i -f k8s/values-dev.yaml $PROJECT k8s/ - name: Deploy Response run: echo "Response was ${{ steps.deploy.outputs.response }}" - name: Notify deploy failure if: ${{ failure() }} uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ job.status }} SLACK_MESSAGE: "Failed to deploy ${{ env.PROJECT }} on dev! :this-is-fine:" - name: Notify deploy success uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to dev! :gopher_party:" build-preprod: runs-on: ubuntu-latest needs: [deploy-dev] steps: - name: Slack Notification uses: rtCamp/action-slack-notify@v2 - name: Checkout uses: actions/checkout@v4 - name: Azure Login uses: azure/login@v2 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Login to ACR uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ secrets.AZURE_CLIENT_ID }} password: ${{ secrets.AZURE_CLIENT_SECRET }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push PREPROD uses: docker/build-push-action@v5 with: context: . build-args: ENVIRONMENT=prd push: true tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-prd cache-from: type=gha cache-to: type=gha,mode=max - name: Notify if failure if: ${{ failure() }} uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ job.status }} SLACK_MESSAGE: "Failed to build ${{ env.PROJECT }} preprod! :this-is-fine:" deploy-preprod: needs: [deploy-dev, build-preprod] runs-on: [ arc-azure-preprod ] environment: preprod steps: - name: Checkout uses: actions/checkout@v4 - name: Notify deploy uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to preprod... :partydeploy:" - name: Deploy to preprod id: deploy uses: koslib/helm-eks-action@v1.28.0 env: KUBE_CONFIG_DATA: ${{ secrets.KUBECONFIG_AZURE_PREPROD }} with: command: | helm upgrade \ --atomic \ --create-namespace \ --namespace default \ --set image.registry=$REGISTRY \ --set image.name=$PROJECT \ --set image.tag=$TAG-prd \ --wait -i -f k8s/values-prd.yaml $PROJECT k8s/ - name: Deploy Response run: echo "Response was ${{ steps.deploy.outputs.response }}" - name: Notify deploy failure if: ${{ failure() }} uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ job.status }} SLACK_MESSAGE: "Failed to deploy ${{ env.PROJECT }} on preprod! :this-is-fine:" - name: Notify deploy success uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to preprod! :gopher_party:" build-cec-prd: runs-on: ubuntu-latest needs: [deploy-dev, deploy-preprod] steps: - name: Slack Notification uses: rtCamp/action-slack-notify@v2 - name: Checkout uses: actions/checkout@v4 - name: Azure Login uses: azure/login@v2 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Login to ACR uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ secrets.AZURE_CLIENT_ID }} password: ${{ secrets.AZURE_CLIENT_SECRET }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push CEC-PRD uses: docker/build-push-action@v5 with: context: . build-args: ENVIRONMENT=cec-prd push: true tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-cec-prd cache-from: type=gha cache-to: type=gha,mode=max - name: Notify if failure if: ${{ failure() }} uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ job.status }} SLACK_MESSAGE: "Failed to build ${{ env.PROJECT }} cec-prd! :this-is-fine:" deploy-cec-prd: needs: [deploy-dev, deploy-preprod, build-cec-prd] runs-on: [ arc-azure-cec-prd ] environment: prd steps: - name: Checkout uses: actions/checkout@v4 - name: Notify deploy uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to cec-prd... :partydeploy:" - name: Deploy to cec-prd id: deploy uses: koslib/helm-eks-action@v1.28.0 env: KUBE_CONFIG_DATA: ${{ secrets.KUBECONFIG_AZURE_CEC_PRD }} with: command: | helm upgrade \ --atomic \ --create-namespace \ --namespace default \ --set image.registry=$REGISTRY \ --set image.name=$PROJECT \ --set image.tag=$TAG-cec-prd \ --wait -i -f k8s/values-cec-prd.yaml $PROJECT k8s/ - name: Deploy Response run: echo "Response was ${{ steps.deploy.outputs.response }}" - name: Notify deploy failure if: ${{ failure() }} uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ job.status }} SLACK_MESSAGE: "Failed to deploy ${{ env.PROJECT }} on cec-prd! :this-is-fine:" - name: Notify deploy success uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to cec-prd! :gopher_party:" build-cec-euprd: runs-on: ubuntu-latest needs: [deploy-dev, deploy-preprod] steps: - name: Slack Notification uses: rtCamp/action-slack-notify@v2 - name: Checkout uses: actions/checkout@v4 - name: Azure Login uses: azure/login@v2 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Login to ACR uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ secrets.AZURE_CLIENT_ID }} password: ${{ secrets.AZURE_CLIENT_SECRET }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push CEC-EUPRD uses: docker/build-push-action@v5 with: context: . build-args: ENVIRONMENT=cec-euprd push: true tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-cec-euprd cache-from: type=gha cache-to: type=gha,mode=max - name: Notify if failure if: ${{ failure() }} uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ job.status }} SLACK_MESSAGE: "Failed to build ${{ env.PROJECT }} cec-euprd! :this-is-fine:" deploy-cec-euprd: needs: [deploy-dev, deploy-preprod, build-cec-euprd] runs-on: [ arc-azure-cec-euprd ] environment: prd steps: - name: Checkout uses: actions/checkout@v4 - name: Notify deploy uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to cec-euprd... :partydeploy:" - name: Deploy to cec-euprd id: deploy uses: koslib/helm-eks-action@v1.28.0 env: KUBE_CONFIG_DATA: ${{ secrets.KUBECONFIG_AZURE_CEC_EUPRD }} with: command: | helm upgrade \ --atomic \ --create-namespace \ --namespace default \ --set image.registry=$REGISTRY \ --set image.name=$PROJECT \ --set image.tag=$TAG-cec-euprd \ --wait -i -f k8s/values-cec-euprd.yaml $PROJECT k8s/ - name: Deploy Response run: echo "Response was ${{ steps.deploy.outputs.response }}" - name: Notify deploy failure if: ${{ failure() }} uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ job.status }} SLACK_MESSAGE: "Failed to deploy ${{ env.PROJECT }} on cec-euprd! :this-is-fine:" - name: Notify deploy success uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to cec-euprd! :gopher_party:"