-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (85 loc) · 3.36 KB
/
deploy-azure.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Deploy tag to Azure
on:
push:
tags:
- "*"
branches:
- "main"
workflow_dispatch:
concurrency:
group: deploy-azure
permissions:
id-token: write
contents: read
jobs:
build-dotnet:
name: Build and deploy
runs-on: ubuntu-latest
environment: azure
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: Restore workloads
run: dotnet workload restore
- name: Restore dependencies
run: dotnet restore
- name: Build release
run: dotnet build --configuration Release
- name: Publish
run: dotnet publish src/WebApp --configuration Release --output src/WebApp/bin/publish --runtime linux-x64 --no-self-contained /p:PublishReadyToRun=true
- name: Azure login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Deploy staging
id: deploy-staging
uses: azure/webapps-deploy@v2
with:
app-name: factoriotools-staging
package: src/WebApp/bin/publish
- name: Send test request
run: |
# cannot use --fail-with-body until https://github.com/curl/curl/issues/9078 makes it into Ubuntu
curl \
--request POST \
--header "Content-Type: application/json" \
--user-agent "GitHub Actions workflow ''$GITHUB_WORKFLOW''" \
--data "{\"blueprint\":\"$BLUEPRINT\"}" \
--fail \
--retry 5 \
"$WEBAPP_URL/api/v1/oil-field/plan"
env:
BLUEPRINT: "0eJyMj70OwjAMhN/lZg8NbHkVhFB/rMrQuFGSIqoq707aMiCVgcWSz+fP5wXNMLEPogl2gbSjRtjLgii91sOqae0YFn5y/l63DxDS7FdFEjtkgmjHL1iTrwTWJEl4Z2zNfNPJNRyKgX6w/BjLwqjrpQI5E+ZSC7WTwO0+qTIdYKc/YKbaaOaAK0G38Pbre8KTQ/wY8hsAAP//AwAEfF3F"
WEBAPP_URL: "${{ steps.deploy-staging.outputs['webapp-url'] }}"
- name: Test
run: dotnet test --no-build --configuration Release --logger "console;verbosity=normal"
- name: Deploy
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v') }}
id: deploy
uses: azure/webapps-deploy@v2
with:
app-name: factoriotools
package: src/WebApp/bin/publish
- name: Send test request
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v') }}
run: |
# cannot use --fail-with-body until https://github.com/curl/curl/issues/9078 makes it into Ubuntu
curl \
--request POST \
--header "Content-Type: application/json" \
--user-agent "GitHub Actions workflow ''$GITHUB_WORKFLOW''" \
--data "{\"blueprint\":\"$BLUEPRINT\"}" \
--fail \
--retry 5 \
"$WEBAPP_URL/api/v1/oil-field/plan"
env:
BLUEPRINT: "0eJyMj70OwjAMhN/lZg8NbHkVhFB/rMrQuFGSIqoq707aMiCVgcWSz+fP5wXNMLEPogl2gbSjRtjLgii91sOqae0YFn5y/l63DxDS7FdFEjtkgmjHL1iTrwTWJEl4Z2zNfNPJNRyKgX6w/BjLwqjrpQI5E+ZSC7WTwO0+qTIdYKc/YKbaaOaAK0G38Pbre8KTQ/wY8hsAAP//AwAEfF3F"
WEBAPP_URL: "${{ steps.deploy.outputs['webapp-url'] }}"