Skip to content

feat(tp): unsubscribe from marketing emails on TP (#986) #408

feat(tp): unsubscribe from marketing emails on TP (#986)

feat(tp): unsubscribe from marketing emails on TP (#986) #408

name: Deploy backend webapp
on:
push:
branches:
- master
- salesforce-integration
- chore/reinstate-terraform-for-azure-migration
- chore/latest-terraform-greek-god-awesome-stuff-terrastos
# paths:
# - 'apps/nestjs-api/**'
# - '.github/workflows/deploy-connect-backend.yml'
jobs:
deploy-staging:
# TODO uncomment when you merge on master
# if: contains(github.ref, 'heads/master') # we want to apply the tf changes only on the `master` branch
environment:
name: staging
url: https://api-staging-redos.azurewebsites.net
runs-on: ubuntu-latest
env:
AZURE_CONTAINER_REGISTRY: ${{ secrets.REGISTRY_NAME }}.azurecr.io
AZURE_IMAGE_NAME_WITH_SHA_TAG: ${{ secrets.REGISTRY_NAME }}.azurecr.io/red-platform-backend:${{ github.sha }}
AZURE_IMAGE_NAME_WITH_LATEST_TAG: ${{ secrets.REGISTRY_NAME }}.azurecr.io/red-platform-backend:latest
steps:
- uses: actions/checkout@master
- name: Azure authentication
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Azure container registry authentication
uses: azure/docker-login@v1
with:
login-server: ${{ env.AZURE_CONTAINER_REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
DOCKER_BUILDKIT=1 docker build -t ${{ env.AZURE_IMAGE_NAME_WITH_SHA_TAG }} -t ${{ env.AZURE_IMAGE_NAME_WITH_LATEST_TAG }} .
docker push ${{ env.AZURE_IMAGE_NAME_WITH_SHA_TAG }}
docker push ${{ env.AZURE_IMAGE_NAME_WITH_LATEST_TAG }}
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: api-staging-redos
images: ${{ env.AZURE_IMAGE_NAME_WITH_LATEST_TAG }}
- name: Azure logout
run: |
az logout
deploy-production:
# TODO uncomment when you merge on master
# if: contains(github.ref, 'heads/master') # we want to apply the tf changes only on the `master` branch
needs: [deploy-staging]
environment:
name: production
url: https://api-prod-redos.azurewebsites.net
runs-on: ubuntu-latest
env:
AZURE_CONTAINER_REGISTRY: ${{ secrets.REGISTRY_NAME }}.azurecr.io
AZURE_IMAGE_NAME_WITH_SHA_TAG: ${{ secrets.REGISTRY_NAME }}.azurecr.io/red-platform-backend:${{ github.sha }}
AZURE_IMAGE_NAME_WITH_LATEST_TAG: ${{ secrets.REGISTRY_NAME }}.azurecr.io/red-platform-backend:latest
steps:
- uses: actions/checkout@master
- name: Azure authentication
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Azure container registry authentication
uses: azure/docker-login@v1
with:
login-server: ${{ env.AZURE_CONTAINER_REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
docker build -t ${{ env.AZURE_IMAGE_NAME_WITH_SHA_TAG }} -t ${{ env.AZURE_IMAGE_NAME_WITH_LATEST_TAG }} .
docker push ${{ env.AZURE_IMAGE_NAME_WITH_SHA_TAG }}
docker push ${{ env.AZURE_IMAGE_NAME_WITH_LATEST_TAG }}
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: api-prod-redos
images: ${{ env.AZURE_IMAGE_NAME_WITH_LATEST_TAG }}
- name: Azure logout
run: |
az logout