-
Notifications
You must be signed in to change notification settings - Fork 48
72 lines (61 loc) · 2.1 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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@v4
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@v4
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 }}