-
Notifications
You must be signed in to change notification settings - Fork 1
153 lines (151 loc) · 4.66 KB
/
ci-develop.yml
File metadata and controls
153 lines (151 loc) · 4.66 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
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
150
151
152
153
name: Deploy Develop Branch
on:
push:
branches:
- develop
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Cache Yarn Dependencies
uses: actions/cache@v5
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Setup Node Version
uses: actions/setup-node@v6
with:
node-version: "lts/jod"
- name: Install Firebase
run: |
npm ci
npm install -g firebase-tools@v13.7.1
- name: Install Dependencies
run: |
cd ./functions
npm ci
cd ../
- name: Build
run: |
cd ./functions
npx tsc --build tsconfig.json
cd ../
- name: Archive Extension Build Artifacts
uses: actions/upload-artifact@v7
with:
name: latest-develop-artifact-${{ github.sha }}
retention-days: 30
path: |
extension.yaml
firebase.json
package.json
package-lock.json
POSTINSTALL.md
PREINSTALL.md
functions/src
functions/__tests__
functions/lib
functions/tsconfig.json
functions/package.json
functions/package-lock.json
ci
test:
name: Test
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v8
with:
name: latest-develop-artifact-${{ github.sha }}
- name: Cache Yarn Dependencies
uses: actions/cache@v5
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Setup Node Version
uses: actions/setup-node@v6
with:
node-version: "lts/jod"
- name: Install Firebase
run: |
npm ci
npm install -g firebase-tools@v13.7.1
- name: Install Dependencies
run: |
cd ./functions
npm ci
cd ../
- name: Run tests with mocks
run: |
firebase emulators:exec --only firestore "cd ./functions && npm test && cd ../"
env:
FIRESTORE_EMULATOR_HOST: "localhost:8080"
- name: Archive Extension Coverage
uses: actions/upload-artifact@v7
with:
name: latest-develop-coverage-${{ github.sha }}
retention-days: 30
path: |
functions/coverage
coverage:
name: Upload Coverage
runs-on: ubuntu-latest
needs: test
steps:
- name: Download Test Coverage Artifacts
uses: actions/download-artifact@v8
with:
name: latest-develop-coverage-${{ github.sha }}
- name: Archive Extension Coverage
run: echo "Upload the extension's test coverage"
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: test
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v8
with:
name: latest-develop-artifact-${{ github.sha }}
- name: Cache Yarn Dependencies
uses: actions/cache@v5
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Setup Node Version
uses: actions/setup-node@v6
with:
node-version: "lts/jod"
- name: Install Firebase
run: |
npm ci
npm install -g firebase-tools@v13.7.1
firebase
- name: Install Dependencies
run: |
cd ./functions
npm ci
cd ../
- name: Export Client Webhook Shared Secret to Extension Params File
env:
PURCHASELY_SHARED_SECRET: ${{ secrets.PURCHASELY_SHARED_SECRET }}
run: |
echo "PURCHASELY_SHARED_SECRET=$PURCHASELY_SHARED_SECRET" >> ./ci/extensions/purchasely-in-app-purchases-ext.env
cat ./ci/extensions/purchasely-in-app-purchases-ext.env
- name: Deploy to Purchasely's Firebase Project
run: |
cd ./ci
ls -al
firebase deploy --only extensions --config ./firebase.json --project $FIREBASE_PROJECT_ID --token $FIREBASE_TOKEN --non-interactive --force
echo "DEPLOYING THE FIREBASE EXTENSION TO PURCHASELY'S PROJECT"
echo "DEPLOYED THE FIREBASE EXTENSION TO PURCHASELY'S PROJECT"
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}