update law #49
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: CI - Deploy App and Bicep | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
pull-requests: write | |
contents: read | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
name: Build, Test, Upload Artifact | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 9.0.x | |
- name: Run dotnet test | |
run: | | |
dotnet test -c Release | |
- name: Run dotnet publish | |
run: | | |
dotnet publish ./src/WorkshopDemo/WorkshopDemo.csproj -c Release -o ./publish | |
- name: Update version file with GHA run number and git short SHA | |
run: echo $(date +'%Y%m%d.%H%M').${{github.run_number}}-$(git rev-parse --short HEAD) > publish/version.txt | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dotnet-artifact | |
path: publish/ | |
dev: | |
needs: build_and_test | |
uses: ./.github/workflows/step-deploy.yml | |
with: | |
env: dev | |
artifact_name: dotnet-artifact | |
resource_group_name: rg-workshop-dnazghbicep-scottsauber-dev | |
app_service_name: app-workshop-dnazghbicep-scottsauber-dev | |
app_service_slot_name: slot | |
# Note: use GH Environment Secrets if using a Pro/Enterprise version of GH | |
secrets: | |
azure_client_id: ${{ secrets.DEV_AZURE_CLIENT_ID }} | |
azure_subscription_id: ${{ secrets.DEV_AZURE_SUBSCRIPTION_ID }} | |
azure_tenant_id: ${{ secrets.DEV_AZURE_TENANT_ID }} | |
prod: | |
needs: dev | |
uses: ./.github/workflows/step-deploy.yml | |
with: | |
env: prod | |
artifact_name: dotnet-artifact | |
resource_group_name: rg-workshop-dnazghbicep-scottsauber-prod | |
app_service_name: app-workshop-dnazghbicep-scottsauber-prod | |
app_service_slot_name: slot | |
# Note: use GH Environment Secrets if using a Pro/Enterprise version of GH | |
secrets: | |
azure_client_id: ${{ secrets.PROD_AZURE_CLIENT_ID }} | |
azure_subscription_id: ${{ secrets.PROD_AZURE_SUBSCRIPTION_ID }} | |
azure_tenant_id: ${{ secrets.PROD_AZURE_TENANT_ID }} |