-
Notifications
You must be signed in to change notification settings - Fork 3
140 lines (114 loc) · 3.94 KB
/
azstorage.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
131
132
133
134
135
136
137
138
139
140
name: Publish Website
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
STAGING_DEPLOYMENT_CLIENT_ID: 9585b6c7-20f9-4756-9e8c-4b34585ac8ca
STAGING_STORAGE_CONTAINER: "$web"
STAGING_STORAGE_ACCOUNT: "blogsierrasoftworksbeta"
STAGING_CDN_RESOURCEGROUP: app-blog
STAGING_CDN_PROFILE: "blog-sierrasoftworks"
STAGING_CDN_ENDPOINT: "blog-sierrasoftworks-staging"
LIVE_DEPLOYMENT_CLIENT_ID: 63951991-4dc9-4524-92cb-53b73016393c
LIVE_STORAGE_CONTAINER: "$web"
LIVE_STORAGE_ACCOUNT: "blogsierrasoftworks"
LIVE_CDN_RESOURCEGROUP: app-blog
LIVE_CDN_PROFILE: "blog-sierrasoftworks"
LIVE_CDN_ENDPOINT: "blog-sierrasoftworks-live"
permissions:
id-token: write
pages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '18'
- name: Restore Packages
run: npm ci
- name: Build Website
run: npm run build --if-present
- name: Upload Artifact for Website
uses: actions/upload-artifact@v2
with:
# Artifact name
name: site
# A file, directory or wildcard pattern that describes what to upload
path: ./dist
deploy-staging:
runs-on: ubuntu-latest
needs: [build]
environment:
name: Staging
url: https://blog-staging.sierrasoftworks.com
steps:
- name: Download Artifacts for Website
uses: actions/download-artifact@v2
with:
name: site
path: ./dist
- name: Login to Azure
uses: azure/login@v1
with:
subscription-id: "108b3ddb-53fb-4344-80b2-d6c151912be6"
tenant-id: "a26571f1-22b3-4756-ac7b-39ca684fab48"
client-id: ${{ env.STAGING_DEPLOYMENT_CLIENT_ID }}
- name: Copy Artifacts to Storage
uses: azure/CLI@v1
with:
inlineScript: |
echo "Uploading Site Contents"
az storage blob sync --container '${{ env.STAGING_STORAGE_CONTAINER }}' --account-name ${{ env.STAGING_STORAGE_ACCOUNT }} --source ./dist
- name: Purge Azure CDN
uses: azure/CLI@v1
with:
inlineScript: |
echo "Purging CDN"
az cdn endpoint purge -g ${{ env.STAGING_CDN_RESOURCEGROUP }} -n ${{ env.STAGING_CDN_ENDPOINT }} --profile-name ${{ env.STAGING_CDN_PROFILE }} --content-paths '/*'
deploy-live:
runs-on: ubuntu-latest
needs: [build, deploy-staging]
if: github.event_name == 'push'
environment:
name: Production
url: https://blog.sierrasoftworks.com
steps:
- name: Download Artifacts for Website
uses: actions/download-artifact@v2
with:
name: site
path: ./dist
- name: Setup GitHub Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
- name: Login to Azure
uses: azure/login@v1
with:
subscription-id: "108b3ddb-53fb-4344-80b2-d6c151912be6"
tenant-id: "a26571f1-22b3-4756-ac7b-39ca684fab48"
client-id: ${{ env.LIVE_DEPLOYMENT_CLIENT_ID }}
- name: Copy Artifacts to Storage
uses: azure/CLI@v1
with:
inlineScript: |
echo "Uploading Site Contents"
az storage blob sync --container '${{ env.LIVE_STORAGE_CONTAINER }}' --account-name ${{ env.LIVE_STORAGE_ACCOUNT }} --source ./dist
- name: Purge Azure CDN
uses: azure/CLI@v1
with:
inlineScript: |
echo "Purging CDN"
az cdn endpoint purge -g ${{ env.LIVE_CDN_RESOURCEGROUP }} -n ${{ env.LIVE_CDN_ENDPOINT }} --profile-name ${{ env.LIVE_CDN_PROFILE }} --content-paths '/*'