-
Notifications
You must be signed in to change notification settings - Fork 32
93 lines (83 loc) · 2.87 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
93
name: Build and Deploy to Azure Functions and GH Pages
on:
workflow_call:
secrets:
# LMAO at how long this is.
SERVER_HOSTNAME:
required: true
FIREBASE_API_KEY:
required: true
FIREBASE_AUTH_DOMAIN:
required: true
FIREBASE_PROJECT_ID:
required: true
FIREBASE_STORAGE_BUCKET:
required: true
FIREBASE_MESSAGING_SENDER_ID:
required: true
FIREBASE_APP_ID:
required: true
AZURE_FUNCTION_APP_NAME:
required: true
AZURE_FUNCTIONAPP_PUBLISH_PROFILE:
required: true
FIREBASE_SERVER_JSON:
required: true
DEPLOY_WEBHOOK_KEY:
required: true
ASWA_API_TOKEN:
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/[email protected]
- run: npm install
- name: Build Frontend
run: npm run build
env:
SERVER_HOSTNAME: ${{ secrets.SERVER_HOSTNAME }}
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
FIREBASE_AUTH_DOMAIN: ${{ secrets.FIREBASE_AUTH_DOMAIN }}
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }}
FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
# - name: Deploy GH Pages
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./dist
- name: Deploy ASWA
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.ASWA_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "/dist" # App source code path
skip_app_build: true
api_location: "" # Api source code path - optional
output_location: "" # Built app content directory - optional
- name: Notify connected clients
run: node deployWebhook.cjs
env:
APP_NAME: ${{ secrets.AZURE_FUNCTION_APP_NAME }}
TOKEN: ${{ secrets.DEPLOY_WEBHOOK_KEY }}
- name: Create Firebase JSON file
working-directory: server
run: echo $FIREBASE_SERVER_JSON > firebase-admin.json
env:
FIREBASE_SERVER_JSON: ${{ secrets.FIREBASE_SERVER_JSON }}
- name: Build Backend
working-directory: server
run: npm install && npm run build
- name: Deploy Backend
uses: Azure/functions-action@v1
with:
app-name: ${{ secrets.AZURE_FUNCTION_APP_NAME }}
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
package: server
scm-do-build-during-deployment: true
enable-oryx-build: true