Deploy DevBox as a Service to Azure #138
Workflow file for this run
This file contains hidden or 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 DevBox as a Service to Azure | |
| permissions: | |
| id-token: write | |
| contents: write | |
| # Trigger the workflow manually | |
| on: | |
| workflow_dispatch: | |
| env: | |
| location: "westus3" | |
| solutionName: "PetDx" | |
| devBoxResourceGroupName: "PetDx-rg" | |
| networkResourceGroupName: "PetDx-Network-rg" | |
| managementResourceGroupName: "PetDx-Management-rg" | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE20: true | |
| jobs: | |
| Test-Azure-Credentials-And-Login: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Log in to Azure using credentials stored in GitHub Secrets | |
| - name: Log in to Azure | |
| uses: azure/login@v2 | |
| with: | |
| creds: ${{ secrets.AZURE_CREDENTIALS }} | |
| Build: | |
| name: Build Bicep Artifacts | |
| runs-on: ubuntu-latest | |
| needs: Test-Azure-Credentials-And-Login | |
| steps: | |
| # Upgrade Bicep to the latest version | |
| - name: Upgrade Bicep | |
| run: | | |
| sudo az bicep upgrade | |
| # Checkout the repository to get the source code | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # Build the Bicep files for Dev Box Management Resources | |
| - name: Build Dev Box Management Resources Bicep files | |
| run: az bicep build --file ./src/deploy/bicep/management/logAnalytics/deploy.bicep --outfile ./bicepArtifacts/deployManagement.json | |
| # Build the Bicep files for Dev Box Network Resources | |
| - name: Build Dev Box Network Resources Bicep files | |
| run: az bicep build --file ./src/deploy/bicep/network/deploy.bicep --outfile ./bicepArtifacts/deployNetwork.json | |
| # Build the Bicep files for Dev Box DevCenter Resources | |
| - name: Build Dev Box DevCenter Resources Bicep files | |
| run: az bicep build --file ./src/deploy/bicep/devBox/deploy.bicep --outfile ./bicepArtifacts/deployDevBox.json | |
| # Compress the built Bicep artifacts into a zip file | |
| - name: Compress Bicep Artifacts | |
| run: | | |
| zip -r bicepArtifacts_v1.0.0-deploy-${{ github.run_number }}.zip ./bicepArtifacts | |
| # Upload the compressed Bicep artifacts | |
| - name: Upload Bicep Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bicepArtifacts_v1.0.0-deploy-${{ github.run_number }}.zip | |
| path: bicepArtifacts_v1.0.0-deploy-${{ github.run_number }}.zip | |
| Deploy: | |
| name: Deploy Dev Box Resources to Azure | |
| runs-on: ubuntu-latest | |
| needs: Build | |
| steps: | |
| # Update packages and upgrade Bicep | |
| - name: Update Packages and Upgrade Bicep | |
| run: | | |
| sudo apt-get update && \ | |
| sudo az bicep upgrade | |
| # Checkout the repository to get the source code | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # Log in to Azure using credentials stored in GitHub Secrets | |
| - name: Log in to Azure | |
| uses: azure/login@v2 | |
| with: | |
| creds: ${{ secrets.AZURE_CREDENTIALS }} | |
| # Grant execute permissions to the deployment script | |
| - name: Grant execute permissions to the script | |
| run: chmod +x ./src/deploy/bicep/bash/deployResourcesOrganization.sh | |
| # Deploy the Landing Zone Resources using the deployment script | |
| - name: Deploy Landing Zone Resources for ${{ env.solutionName }} | |
| run: ./src/deploy/bicep/bash/deployResourcesOrganization.sh ${{ env.devBoxResourceGroupName }} ${{ env.networkResourceGroupName }} ${{ env.managementResourceGroupName }} ${{ env.location }} | |
| # Deploy Log Analytics resources using ARM template | |
| - name: Deploy Dev Box Management Resources to Azure | |
| uses: azure/arm-deploy@v1 | |
| with: | |
| subscriptionId: ${{ secrets.AZURE_CREDENTIALS.subscriptionId }} | |
| resourceGroupName: ${{ env.managementResourceGroupName }} | |
| template: ./src/deploy/bicep/management/logAnalytics/deploy.bicep | |
| parameters: 'solutionName=${{ env.solutionName }}' | |
| # Deploy Network Connectivity Resources using ARM template | |
| - name: Deploy Dev Box Network Resources to Azure | |
| uses: azure/arm-deploy@v1 | |
| with: | |
| subscriptionId: ${{ secrets.AZURE_CREDENTIALS.subscriptionId }} | |
| resourceGroupName: ${{ env.networkResourceGroupName }} | |
| template: ./src/deploy/bicep/network/deploy.bicep | |
| parameters: 'solutionName=${{ env.solutionName }} managementResourceGroupName=${{ env.managementResourceGroupName }}' | |
| # Deploy Dev Center Resources using ARM template | |
| - name: Deploy Dev Box DevCenter Resources to Azure | |
| uses: azure/arm-deploy@v1 | |
| with: | |
| subscriptionId: ${{ secrets.AZURE_CREDENTIALS.subscriptionId }} | |
| resourceGroupName: ${{ env.devBoxResourceGroupName }} | |
| template: ./src/deploy/bicep/devBox/deploy.bicep | |
| parameters: 'solutionName=${{ env.solutionName }}' | |
| publish-bicep-artifacts: | |
| runs-on: ubuntu-latest | |
| needs: Build | |
| steps: | |
| # Checkout the repository to get the source code | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| # Download the previously uploaded Bicep artifacts | |
| - name: Download Bicep Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: bicepArtifacts_v1.0.0-deploy-${{ github.run_number }}.zip | |
| # Upload the Bicep artifacts to storage (add your upload logic here) | |
| - name: Upload Bicep Artifacts to Storage | |
| run: | | |
| # Add your upload logic here | |
| echo "Uploading Bicep artifacts" |