Skip to content

Website URL Output

Website URL Output #4

Workflow file for this run

name: Todo App PR Validation
concurrency:
group: ${{ github.event.number }}
cancel-in-progress: false
on:
pull_request:
branches:
- main
permissions:
id-token: write
contents: read
env:
resourceGroupName: pr_${{ github.event.number }}
resourceGroupLocation: westeurope
# https://learn.microsoft.com/en-us/training/modules/automate-azure-infrastructure-change-reviews-using-bicep-github/6-exercise-create-ephemeral-environments-pull-requests
jobs:
lint-infra:
name: Lint infrastructure
uses: ./.github/workflows/lint.yml
build-app:
name: Build application
uses: ./.github/workflows/build.yml
deploy-infra:
name: Deploy infrastructure
runs-on: ubuntu-latest
environment: test
outputs:
appServiceAppName: ${{ steps.deploy.outputs.appServiceAppName }}
appServiceAppHostName: ${{ steps.deploy.outputs.appServiceAppHostName }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- uses: azure/cli@v2
name: Create resource group
with:
inlineScript: |
az group create \
--name ${{ env.resourceGroupName }} \
--location ${{ env.resourceGroupLocation }}
- uses: azure/arm-deploy@v2
id: deploy
name: Deploy infrastructure
with:
deploymentName: ${{ github.run_number }}
scope: resourcegroup
resourceGroupName: ${{ env.resourceGroupName }}
template: ./infra/main.bicep
parameters: >
environment=test
deploymentMode: Complete
failOnStdErr: false
- name: Website URL
run: 'echo "Website URL (test) 🚀: https://${{ steps.deploy.outputs.appServiceAppHostName }}" >> "${GITHUB_STEP_SUMMARY}"'
needs: [lint-infra, build-app]
deploy-app:
name: Deploy application
uses: ./.github/workflows/deploy-app.yml
with:
environment: test
appServiceAppName: ${{ needs.deploy-infra.outputs.appServiceAppName }}
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
needs: [deploy-infra]