-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (128 loc) · 4.87 KB
/
azure_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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Deploy app to Azure
on:
push:
branches: [main, develop]
paths-ignore:
- "apps/api/**"
pull_request:
branches: [main, develop, dependency_updates]
paths-ignore:
- "apps/api/**"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
deploy_to_storage:
name: Deploy app to Azure
runs-on: ubuntu-latest
env:
NEXT_PUBLIC_SENTRY: "https://[email protected]/5799127"
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Enable Corepack before setting up Node
run: corepack enable
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "yarn"
- run: corepack enable && yarn install
- run: yarn run check-types
- run: yarn run check-format
- name: Test build
env:
NEXT_PUBLIC_API_HOST: https://prod-mong-api.skde.org
run: |
yarn run export
- name: Build and upload main branch version to Azure
if: github.ref == 'refs/heads/main'
env:
NEXT_PUBLIC_API_HOST: https://prod-mong-api.skde.org
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT_PROD }}
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY_PROD }}
run: |
yarn run export
az storage blob sync \
--account-name $AZURE_STORAGE_ACCOUNT \
--account-key $AZURE_STORAGE_KEY \
--container '$web' \
--source ./apps/skde/out \
--delete-destination true
az storage blob upload-batch \
--account-name $AZURE_STORAGE_ACCOUNT \
--account-key $AZURE_STORAGE_KEY \
--destination '$web' \
--source ./apps/skde/out \
--pattern '*.html' \
--content-cache-control "public, max-age=60, s-maxage=60" \
--overwrite
az storage blob upload-batch \
--account-name $AZURE_STORAGE_ACCOUNT \
--account-key $AZURE_STORAGE_KEY \
--destination '$web' \
--source ./apps/skde/out \
--pattern '*.xml' \
--content-cache-control "public, max-age=60, s-maxage=60" \
--overwrite
- name: Build and upload verify version to Azure
if: github.ref == 'refs/heads/main'
env:
NEXT_PUBLIC_VERIFY: "true"
NEXT_PUBLIC_API_HOST: https://verify-mong-api.skde.org
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT_VERIFY }}
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY_VERIFY }}
run: |
yarn run export
az storage blob sync \
--account-name $AZURE_STORAGE_ACCOUNT \
--account-key $AZURE_STORAGE_KEY \
--container '$web' \
--source ./apps/skde/out \
--delete-destination true
az storage blob upload-batch \
--account-name $AZURE_STORAGE_ACCOUNT \
--account-key $AZURE_STORAGE_KEY \
--destination '$web' \
--source ./apps/skde/out \
--pattern '*.html' \
--content-cache-control "public, max-age=60, s-maxage=60" \
--overwrite
az storage blob upload-batch \
--account-name $AZURE_STORAGE_ACCOUNT \
--account-key $AZURE_STORAGE_KEY \
--destination '$web' \
--source ./apps/skde/out \
--pattern '*.xml' \
--content-cache-control "public, max-age=60, s-maxage=60" \
--overwrite
- name: Upload develop version to Azure
if: github.ref == 'refs/heads/develop'
env:
NEXT_PUBLIC_API_HOST: https://qa-mong-api.skde.org
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT_TEST }}
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY_TEST }}
run: |
yarn run export
az storage blob sync \
--account-name $AZURE_STORAGE_ACCOUNT \
--account-key $AZURE_STORAGE_KEY \
--container '$web' \
--source ./apps/skde/out \
--delete-destination true
az storage blob upload-batch \
--account-name $AZURE_STORAGE_ACCOUNT \
--account-key $AZURE_STORAGE_KEY \
--destination '$web' \
--source ./apps/skde/out \
--pattern '*.html' \
--content-cache-control "public, max-age=60, s-maxage=60" \
--overwrite
az storage blob upload-batch \
--account-name $AZURE_STORAGE_ACCOUNT \
--account-key $AZURE_STORAGE_KEY \
--destination '$web' \
--source ./apps/skde/out \
--pattern '*.xml' \
--content-cache-control "public, max-age=60, s-maxage=60" \
--overwrite