-
Notifications
You must be signed in to change notification settings - Fork 5
109 lines (89 loc) · 2.83 KB
/
release.developer.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
name: Release Events (Developer)
on:
release:
types:
- published
defaults:
run:
working-directory: src/developer
permissions:
contents: write
id-token: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
test-unit:
name: 🧪 Unit tests
runs-on: ubuntu-latest
steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
cache-dependency-path: src/developer/package-lock.json
- name: 📥 Download dependencies
run: npm ci
- name: 📥 Download dependencies
run: npm ci
working-directory: src/developer/functions
- name: 🧪 Run tests
run: npm test
deploy-prod:
name: 🚀 Production deployment
if: ${{ startsWith(github.ref, 'refs/tags/developer') }}
runs-on: ubuntu-latest
needs: [test-unit]
environment:
name: prod
steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
cache-dependency-path: src/developer/package-lock.json
- name: 📥 Download dependencies
shell: bash
run: npm ci
- name: 🏗 Run build command
shell: bash
run: npm run build
env:
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
VITE_API_EXPLORER_URL: ${{ vars.API_EXPLORER_URL }}
- name: 🔢 Get firebase version
id: cache-settings
run: |
echo "firebase-tools=$(npm list -s --depth=0 | grep firebase-tools | tail -n 1 | sed 's/.*@//g')" >> GITHUB_OUTPUT
- name: 🪣 Cache firebase
uses: actions/cache@v4
with:
path: ~/.cache/firebase
key: ${{ runner.os }}-firebase-${{ steps.cache-settings.outputs.firebase-tools }}
- name: 🗝️ Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v2
with:
access_token_scopes: "email, openid, https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/firebase"
workload_identity_provider: ${{ secrets.IDENTITY_PROVIDER }}
service_account: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
create_credentials_file: true
- name: 📨 Create function envs
shell: bash
run: |
touch ./functions/.env
echo "REDIS_HOST=${{ secrets.REDIS_HOST }}" >> ./functions/.env
- name: 🚀 Firebase deploy
shell: bash
run: npx firebase-tools deploy --project ${{ secrets.PROJECT_ID }}