-
Notifications
You must be signed in to change notification settings - Fork 210
149 lines (123 loc) · 4.22 KB
/
firebase-hosting-merge.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
141
142
143
144
145
146
147
148
149
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools
name: Deploy to Firebase Hosting on merge
on:
push:
branches:
- main
- develop
jobs:
build_and_deploy_sandbox:
name: "Deploy to Marvel Develop"
if: ${{ github.ref == 'refs/heads/develop' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18.17.0"
- name: Install Firebase CLI
run: |
npm install -g firebase-tools
- name: Install Functions Dependencies
run: |
cd functions
npm install
- name: Decode Base64 Env Vars for Develop
if: github.ref == 'refs/heads/develop'
run: |
cd functions
echo "${{ secrets.SANDBOX_ENV_FILE_BASE64 }}" | base64 --decode > .env
- name: Deploy Functions to Develop
if: github.ref == 'refs/heads/develop'
run: |
set -o allexport
source functions/.env
set +o allexport
firebase deploy --only functions --force --token ${{ secrets.FIREBASE_TOKEN }} --project kai-platform-sandbox
- name: Decode and create .env file from secret
run: |
echo "${{ secrets.SANDBOX_ENV_FILE_BASE64 }}" | base64 --decode > .env
- name: Set environment variables
run: |
set -a
source .env
set +a
- name: Install Next.js globally
run: npm install -g next
- name: Build Next.js
run: npm run build:next
- name: Set Channel ID
id: set_channel_id
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "channel_id=live" >> $GITHUB_ENV
else
echo "channel_id=pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
fi
- name: Deploy to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GIT_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_SANDBOX }}
projectId: kai-platform-sandbox
channelId: ${{ env.channel_id }}
build_and_deploy_production:
name: "Deploy to Marvel Production"
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18.17.0"
- name: Install Firebase CLI
run: |
npm install -g firebase-tools
- name: Install Functions Dependencies
run: |
cd functions
npm install
- name: Decode Base64 Env Vars for Specific Branches
if: github.ref == 'refs/heads/main'
run: |
cd functions
echo "${{ secrets.PROD_ENV_FILE_BASE64 }}" | base64 --decode > .env
- name: Deploy Functions to Production
if: github.ref == 'refs/heads/main'
run: |
set -o allexport
source functions/.env
set +o allexport
firebase deploy --only functions --force --token ${{ secrets.FIREBASE_TOKEN }} --project kai-ai-f63c8
- name: Decode and create .env file from secret
run: |
echo "${{ secrets.PROD_ENV_FILE_BASE64 }}" | base64 --decode > .env
- name: Set environment variables
run: |
set -a
source .env
set +a
- name: Install Next.js globally
run: npm install -g next
- name: Build Next.js
run: npm run build:next
- name: Set Channel ID
id: set_channel_id
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "channel_id=live" >> $GITHUB_ENV
else
echo "channel_id=pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
fi
- name: Deploy to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GIT_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KAI_AI_F63C8 }}
projectId: kai-ai-f63c8
channelId: ${{ env.channel_id }}