-
Notifications
You must be signed in to change notification settings - Fork 3
61 lines (51 loc) · 1.53 KB
/
dev.yml
File metadata and controls
61 lines (51 loc) · 1.53 KB
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
name: Build & Deploy
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '12'
- run: npm install
- run: npm run build
- run: npm run lint
- run: npm run test
- name: Examine changes
run: |-
echo 'FILES_CHANGED<<EOF' >> $GITHUB_ENV
git diff --exit-code dist/index.js >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Update dist
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && env.FILES_CHANGED }}
uses: swinton/commit@v2.x
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files:
dist/index.js
commit-message: Update dist
Deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Upload to blob storage
uses: Azure/cli@1.0.4
with:
inlineScript: |
az storage blob upload-batch --account-name staticcontent1 --account-key ${{ secrets.AZURE_STORAGE_KEY }} --auth-mode key --overwrite -d '$web' -s dist/
- name: Purge CDN endpoint
uses: azure/CLI@v1
with:
inlineScript: |
az cdn endpoint purge --content-paths "/*" --profile-name "staticwebsite" --name "staticwebsite123" --resource-group "tester"
- name: logout
run: |
az logout
if: always()