Configure HTTPS on website #10
This file contains 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-toy-website-test | |
concurrency: toy-company | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
AZURE_RESOURCEGROUP_NAME: ToyWebsiteTest | |
ENVIRONMENT_TYPE: Test | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run Bicep linter | |
run: az bicep build --file deploy/main.bicep | |
validate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: azure/login@v1 | |
name: Sign in to Azure | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- uses: azure/arm-deploy@v1 | |
name: Run preflight validation | |
with: | |
deploymentName: ${{ github.run_number }} | |
resourceGroupName: ${{ env.AZURE_RESOURCEGROUP_NAME }} | |
template: ./deploy/main.bicep | |
parameters: environmentType=${{ env.ENVIRONMENT_TYPE }} | |
deploymentMode: Validate | |
preview: | |
runs-on: ubuntu-latest | |
needs: [lint, validate] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: azure/login@v1 | |
name: Sign in to Azure | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- uses: azure/arm-deploy@v1 | |
name: Run what-if | |
with: | |
failOnStdErr: false | |
resourceGroupName: ${{ env.AZURE_RESOURCEGROUP_NAME }} | |
template: deploy/main.bicep | |
parameters: > | |
environmentType=${{ env.ENVIRONMENT_TYPE }} | |
additionalArguments: --what-if | |
deploy: | |
runs-on: ubuntu-latest | |
environment: Website | |
needs: preview | |
outputs: | |
appServiceAppHostName: ${{ steps.deploy.outputs.appServiceAppHostName }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: azure/login@v1 | |
name: Sign in to Azure | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- uses: azure/arm-deploy@v1 | |
id: deploy | |
name: Deploy website | |
with: | |
failOnStdErr: false | |
deploymentName: ${{ github.run_number }} | |
resourceGroupName: ${{ env.AZURE_RESOURCEGROUP_NAME }} | |
template: ./deploy/main.bicep | |
parameters: environmentType=${{ env.ENVIRONMENT_TYPE }} | |
smoke-test: | |
runs-on: ubuntu-latest | |
needs: deploy | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | | |
$container = New-PesterContainer ` | |
-Path 'deploy/Website.Tests.ps1' ` | |
-Data @{ HostName = '${{needs.deploy.outputs.appServiceAppHostName}}' } | |
Invoke-Pester ` | |
-Container $container ` | |
-CI | |
name: Run smoke tests | |
shell: pwsh |