Azure Deploy #10
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: Azure Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'generate-url-shortene/infrastructure/**' | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'generate-url-shortene/infrastructure/**' | |
| workflow_dispatch: # Allows you to run the workflow manually | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| deploy-dev: | |
| runs-on: ubuntu-latest | |
| environment: Development | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Azure Login | |
| uses: azure/[email protected] | |
| with: | |
| creds: ${{ secrets.AZURE_CREDENTIALS }} | |
| - uses: azure/[email protected] | |
| with: | |
| inlineScript: | | |
| #!/bin/bash | |
| az group create --name ${{ vars.RESOURCE_GROUP_NAME }} --location ${{ vars.RESOURCE_GROUP_LOCATION }} | |
| echo "Resource Group Created" | |
| - name: Deploy Bicep Template | |
| uses: azure/arm-deploy@v2 | |
| with: | |
| scope: resourcegroup | |
| resourceGroupName: ${{ vars.RESOURCE_GROUP_NAME }} | |
| template: ./infrastructure/main.bicep | |
| failOnStdErr: true | |
| deploy-stg: | |
| runs-on: ubuntu-latest | |
| needs: deploy-dev | |
| environment: Staging | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Azure Login | |
| uses: azure/[email protected] | |
| with: | |
| creds: ${{ secrets.AZURE_CREDENTIALS }} | |
| - uses: azure/[email protected] | |
| with: | |
| inlineScript: | | |
| #!/bin/bash | |
| az group create --name ${{ vars.RESOURCE_GROUP_NAME }} --location ${{ vars.RESOURCE_GROUP_LOCATION }} | |
| echo "Resource Group Created" | |
| - name: Deploy Bicep Template | |
| uses: azure/arm-deploy@v2 | |
| with: | |
| scope: resourcegroup | |
| resourceGroupName: ${{ vars.RESOURCE_GROUP_NAME }} | |
| template: ./infrastructure/main.bicep | |
| failOnStdErr: true | |
| deploy-prod: | |
| runs-on: ubuntu-latest | |
| needs: deploy-stg | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| environment: Production | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Azure Login | |
| uses: azure/[email protected] | |
| with: | |
| creds: ${{ secrets.AZURE_CREDENTIALS }} | |
| - uses: azure/[email protected] | |
| with: | |
| inlineScript: | | |
| #!/bin/bash | |
| az group create --name ${{ vars.RESOURCE_GROUP_NAME }} --location ${{ vars.RESOURCE_GROUP_LOCATION }} | |
| echo "Resource Group Created" | |
| - name: Deploy Bicep Template | |
| uses: azure/arm-deploy@v2 | |
| with: | |
| scope: resourcegroup | |
| resourceGroupName: ${{ vars.RESOURCE_GROUP_NAME }} | |
| template: ./infrastructure/main.bicep | |
| failOnStdErr: true |