-
Notifications
You must be signed in to change notification settings - Fork 5
92 lines (80 loc) · 3.1 KB
/
deploy.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
name: Build and deploy
on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Dump GitHub context
run: echo Deployment for ${{ github.ref }}
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
# Use dev image in manifest.json and appsettings.json
- name: Find and Replace
if: github.ref == 'refs/heads/dev'
uses: jacobtomlinson/gha-find-replace@master
with:
find: "android-chrome-192x192.png"
replace: "android-chrome-192x192-dev.png"
# Replace values in appsettings.json (prod only)
- uses: microsoft/variable-substitution@v1
if: github.ref == 'refs/heads/master'
with:
files: '**/appsettings.json'
env:
App.IsDev: "false"
App.Environment: "Prod"
App.Title: "Cognitive Studio"
- name: Test
run: dotnet test ./src/CognitiveServices.Explorer/CognitiveServices.Explorer.sln --configuration Release
- name: Publish
run: dotnet publish ./src/CognitiveServices.Explorer/ -c Release -o ./dist/
- name: Azure Blob Storage Upload (production)
if: github.ref == 'refs/heads/master'
uses: bacongobbler/azure-blob-storage-upload@v1.0.0
with:
# The name of the directory you want to upload
source_dir: ./dist/wwwroot/
# The name of the storage account container these assets will be uploaded to
container_name: $web
# The connection string for the storage account
connection_string: ${{secrets.AzureBlobStorageConnectionString}}
# extra arguments that can be passed to `az storage blob upload-batch`. Useful for passing flags like `--pattern` or `--destination-path`
#extra_args: # optional
- name: Azure Blob Storage Upload (dev)
if: github.ref == 'refs/heads/dev'
uses: bacongobbler/azure-blob-storage-upload@v1.0.0
with:
# The name of the directory you want to upload
source_dir: ./dist/wwwroot/
# The name of the storage account container these assets will be uploaded to
container_name: $web
# The connection string for the storage account
connection_string: ${{secrets. AzureDevBlobStorageConnectionString}}
# extra arguments that can be passed to `az storage blob upload-batch`. Useful for passing flags like `--pattern` or `--destination-path`
#extra_args: # optional
- name: HTTP Request Action
uses: fjogeleit/http-request-action@1.3.0
with:
# Request URL
url: https://api.cloudflare.com/client/v4/zones/${{secrets.CloudFlareZoneId}}/purge_cache
# Request Method
method: POST
# Content Type
contentType: application/json
# Request Body as JSON String
data: "{\"purge_everything\":true}"
# Request Timeout in Sec
timeout: 360
# Bearer Authentication Token
bearerToken: ${{secrets.CloudFlareToken}}