name: OTA Admin Portal v2 Deploy on: push: branches: - v2/trunk 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" JFROG_NPMRC: ${{ secrets.JFROG_NPMRC }} TAG: ${{ github.sha }} PROJECT: ota-admin-portal-v2 REGISTRY: fiskercloud.azurecr.io jobs: build: runs-on: ubuntu-latest steps: - name: Slack Notification uses: rtCamp/action-slack-notify@v2 - name: Checkout uses: actions/checkout@v3 - name: Azure Login uses: azure/login@v1 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Login to ACR uses: docker/login-action@v2 with: registry: ${{ env.REGISTRY }} username: ${{ secrets.AZURE_CLIENT_ID }} password: ${{ secrets.AZURE_CLIENT_SECRET }} - name: JFrog Auth run: echo ${JFROG_NPMRC} | base64 -d > .npmrc - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Build and push uses: docker/build-push-action@v4 with: context: . push: true tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }} 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] runs-on: [self-hosted, azure] environment: dev steps: - name: Checkout uses: actions/checkout@v3 - uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to dev... :partydeploy:" - name: Deploy to dev run: |- helm upgrade \ --kube-context dev \ --set image.registry=$REGISTRY \ --set image.name=$PROJECT \ --set image.tag=$TAG \ --wait -i -f k8s/values-dev.yaml $PROJECT k8s/ - 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:" deploy-stg: needs: [build, deploy-dev] runs-on: [self-hosted, azure] environment: stg steps: - name: Checkout uses: actions/checkout@v3 - uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to stg... :partydeploy:" - name: Deploy to stg run: |- helm upgrade \ --kube-context stg \ --set image.registry=$REGISTRY \ --set image.name=$PROJECT \ --set image.tag=$TAG \ --wait -i -f k8s/values-stg.yaml $PROJECT k8s/ - 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 stg! :this-is-fine:" - name: Notify deploy success uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to stg! :gopher_party:" deploy-preprod: needs: [build, deploy-dev] runs-on: [self-hosted, azure] environment: stg steps: - name: Checkout uses: actions/checkout@v3 - uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to preprod... :partydeploy:" - name: Deploy to preprod run: |- helm upgrade \ --kube-context prd \ --set image.registry=$REGISTRY \ --set image.name=$PROJECT \ --set image.tag=$TAG \ --wait -i -f k8s/values-prd.yaml $PROJECT k8s/ - 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:" deploy-cec-prd: needs: [build, deploy-dev, deploy-stg, deploy-preprod] runs-on: [self-hosted, azure] environment: prd steps: - name: Checkout uses: actions/checkout@v3 - uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to cec-prd... :partydeploy:" - name: Deploy to cec-prd run: |- helm upgrade \ --kube-context cec-prd-cluster-1 \ --set image.registry=$REGISTRY \ --set image.name=$PROJECT \ --set image.tag=$TAG \ --wait -i -f k8s/values-cec-prd.yaml $PROJECT k8s/ - 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:" deploy-cec-euprd: needs: [build, deploy-dev, deploy-stg, deploy-preprod, deploy-cec-prd] runs-on: [self-hosted, azure] environment: prd steps: - name: Checkout uses: actions/checkout@v3 - uses: rtCamp/action-slack-notify@v2 env: MSG_MINIMAL: true SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to cec-euprd... :partydeploy:" - name: Deploy to cec-euprd run: |- helm upgrade \ --kube-context cec-euprd-cluster-1 \ --set image.registry=$REGISTRY \ --set image.name=$PROJECT \ --set image.tag=$TAG \ --wait -i -f k8s/values-cec-euprd.yaml $PROJECT k8s/ - 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:"