Skip to content

Commit

Permalink
Re-enable deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
harryy94 committed Feb 4, 2025
1 parent 1150723 commit 4962162
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 77 deletions.
154 changes: 77 additions & 77 deletions .github/workflows/deploy-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@ on:
workflow_dispatch:

jobs:
# package:
# name: 'Package Web in Docker'
# runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: ./src
# permissions:
# contents: read
# packages: write
#
# steps:
# - uses: actions/checkout@v4
#
# - name: Lowercase the repo name and username
# run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
#
# - name: Build Web Docker Image
# run: |
# docker build . -t ghcr.io/${{ env.REPO }}:${{ github.sha }} -f web/CareLeavers.Web/Dockerfile
#
# - uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Push Web Docker Image
# run: docker push ghcr.io/${{ env.REPO }}:${{ github.sha }}
package:
name: 'Package Web in Docker'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Lowercase the repo name and username
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}

- name: Build Web Docker Image
run: |
docker build . -t ghcr.io/${{ env.REPO }}:${{ github.sha }} -f web/CareLeavers.Web/Dockerfile
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push Web Docker Image
run: docker push ghcr.io/${{ env.REPO }}:${{ github.sha }}
#
# terraform_dependencies:
# name: 'Provision Terraform Dependencies'
Expand Down Expand Up @@ -112,52 +112,52 @@ jobs:
working-directory: ./src/infrastructure/terraform
run: terraform apply plan.plan

# deploy-backend:
# name: Deploy Web
# permissions:
# contents: none
# id-token: write
# runs-on: ubuntu-latest
# needs: [ package, deploy_infrastructure ]
# environment:
# name: 'Test'
#
# steps:
# - name: Lowercase the repo name and username
# run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
#
# - name: 'Az CLI login'
# uses: azure/login@v1
# with:
# creds: |
# {
# "clientId": "${{ secrets.AZURE_CLIENT_ID }}",
# "clientSecret": "${{ secrets.AZURE_CLIENT_SECRET }}",
# "tenantId": "${{ secrets.AZURE_TENANT_ID }}",
# "subscriptionId": "${{ secrets.AZURE_SUBSCRIPTION_ID }}"
# }
#
# - name: 'Get publishing profile'
# run: |
# publishingProfile=$(az webapp deployment list-publishing-profiles --name s186${{ vars.ENVIRONMENT_PREFIX }}-cl-web-app-service --slot staging --resource-group s186${{ vars.ENVIRONMENT_PREFIX }}-cl-web-rg --xml)
# echo "PUBLISHING_PROFILE=$publishingProfile" >>${GITHUB_ENV}
#
# - name: Deploy to Azure Web App
# id: deploy-to-webapp
# uses: azure/webapps-deploy@v2
# with:
# app-name: ${{ vars.DEV_AZURE_WEBAPP_NAME }}
# slot-name: 'staging'
# publish-profile: ${{ env.PUBLISHING_PROFILE }}
# images: 'ghcr.io/${{ env.REPO }}:${{ github.sha }}'
#
# - name: Wait for Staging to warm up
# id: wait-for-staging
# uses: jtalk/url-health-check-action@v4
# with:
# url: https://s186${{ vars.ENVIRONMENT_PREFIX }}-cl-web-fd.azurefd.net/staging-health
# retry-delay: 3s
# max-attempts: 5
#
# - name: Swap slot to production
# run: az webapp deployment slot swap --name s186${{ vars.ENVIRONMENT_PREFIX }}-cl-web-app-service --resource-group s186${{ vars.ENVIRONMENT_PREFIX }}-cl-web-rg --slot staging --target-slot production
deploy-backend:
name: Deploy Web
permissions:
contents: none
id-token: write
runs-on: ubuntu-latest
needs: [ package, deploy_infrastructure ]
environment:
name: 'Test'

steps:
- name: Lowercase the repo name and username
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}

- name: 'Az CLI login'
uses: azure/login@v1
with:
creds: |
{
"clientId": "${{ secrets.AZURE_CLIENT_ID }}",
"clientSecret": "${{ secrets.AZURE_CLIENT_SECRET }}",
"tenantId": "${{ secrets.AZURE_TENANT_ID }}",
"subscriptionId": "${{ secrets.AZURE_SUBSCRIPTION_ID }}"
}
- name: 'Get publishing profile'
run: |
publishingProfile=$(az webapp deployment list-publishing-profiles --name s186${{ vars.ENVIRONMENT_PREFIX }}-cl-web-app-service --slot staging --resource-group s186${{ vars.ENVIRONMENT_PREFIX }}-cl-web-rg --xml)
echo "PUBLISHING_PROFILE=$publishingProfile" >>${GITHUB_ENV}
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ vars.DEV_AZURE_WEBAPP_NAME }}
slot-name: 'staging'
publish-profile: ${{ env.PUBLISHING_PROFILE }}
images: 'ghcr.io/${{ env.REPO }}:${{ github.sha }}'

- name: Wait for Staging to warm up
id: wait-for-staging
uses: jtalk/url-health-check-action@v4
with:
url: https://s186${{ vars.ENVIRONMENT_PREFIX }}-cl-web-fd.azurefd.net/staging-health
retry-delay: 3s
max-attempts: 5

- name: Swap slot to production
run: az webapp deployment slot swap --name s186${{ vars.ENVIRONMENT_PREFIX }}-cl-web-app-service --resource-group s186${{ vars.ENVIRONMENT_PREFIX }}-cl-web-rg --slot staging --target-slot production
1 change: 1 addition & 0 deletions src/infrastructure/terraform/frontdoor.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ resource "azurerm_cdn_frontdoor_profile" "frontdoor-web-profile" {
name = "${local.service_prefix}-web-fd-profile"
resource_group_name = azurerm_resource_group.web-rg.name
sku_name = "Standard_AzureFrontDoor"
tags = local.common_tags
}

resource "azurerm_cdn_frontdoor_origin_group" "frontdoor-origin-group" {
Expand Down

0 comments on commit 4962162

Please sign in to comment.