-
Notifications
You must be signed in to change notification settings - Fork 16
95 lines (91 loc) · 2.45 KB
/
cd.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
name: Deploy React App
permissions:
id-token: write
contents: read
on:
push:
branches:
- main
paths-ignore:
- '.devcontainer/**'
- '.github/**'
- '.vscode/**'
- 'infra/**'
- '**.md'
env:
STORAGE_ACCOUNT_NAME: ${{ vars.STORAGE_ACCOUNT_NAME }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node 16.x
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build:ci
- name: Archive build
if: success()
uses: actions/upload-artifact@v1
with:
name: deploy_dist
path: build
deployment-staging:
name: Deploy to Staging
runs-on: ubuntu-latest
needs: build
environment: staging
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Download build
uses: actions/download-artifact@v1
with:
name: deploy_dist
- name: Upload to blob storage
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob upload-batch --account-name $STORAGE_ACCOUNT_NAME --auth-mode key -d '$web' -s ./deploy_dist --overwrite
- name: logout
run: |
az logout
if: always()
deployment-production:
name: Deploy to Production
runs-on: ubuntu-latest
needs: deployment-staging
environment: production
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Download build
uses: actions/download-artifact@v1
with:
name: deploy_dist
- name: Upload to blob storage
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob upload-batch --account-name $STORAGE_ACCOUNT_NAME --auth-mode key -d '$web' -s ./deploy_dist --overwrite
- name: logout
run: |
az logout
if: always()