This repository was archived by the owner on Oct 25, 2026. It is now read-only.
Repository navigation
92 lines (80 loc) · 3.5 KB
/
Copy pathdeploy.yml
File metadata and controls
92 lines (80 loc) · 3.5 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
name: Deploy to Firebase
on:
push:
branches: [main, master]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
cache-dependency-path: |
client/package-lock.json
functions/package-lock.json
- name: Install client dependencies
working-directory: ./client
run: npm ci
- name: Build client
working-directory: ./client
run: npm run build
- name: Install functions dependencies
working-directory: ./functions
run: npm ci
- name: Build functions
working-directory: ./functions
run: npm run build
- name: Install Firebase CLI
run: npm install -g firebase-tools
- name: Check the Alchemy key on every network
env:
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
run: |
# Same networks as ALCHEMY_NETWORKS in functions/src/index.ts.
for network in base-mainnet plasma-mainnet eth-mainnet eth-sepolia \
opt-mainnet arb-mainnet gnosis-mainnet avax-mainnet sonic-mainnet; do
if curl -sf -X POST -H 'Content-Type: application/json' \
--data '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}' \
"https://${network}.g.alchemy.com/v2/${ALCHEMY_API_KEY}" \
| jq -e '.result' > /dev/null; then
echo "ok $network"
else
echo "failed $network"
exit 1
fi
done
# The firebase-functions SDK lists an empty "extensions" entry in its
# manifest, and firebase-tools takes that as a request to deploy Firebase
# Extensions. That step checks billing through the Cloud Billing API,
# which is turned off in this project and which the deploy account cannot
# turn on. firebase-tools reads functions/functions.yaml instead of asking
# the SDK when the file exists, so this writes the SDK's manifest there
# without that entry.
- name: Write the functions manifest without the extensions entry
working-directory: ./functions
run: |
FUNCTIONS_CONTROL_API=true node -e '
const { loadStack } = require("./node_modules/firebase-functions/lib/runtime/loader.js");
const { stackToWire } = require("./node_modules/firebase-functions/lib/runtime/manifest.js");
loadStack(".").then((stack) => {
const manifest = stackToWire(stack);
delete manifest.extensions;
require("fs").writeFileSync("functions.yaml", JSON.stringify(manifest, null, 2));
});
'
# Deploys only the two functions the live site calls. The site itself is
# left alone, because the client in this repo calls autorangeData, which
# has never been deployed.
- name: Deploy to Firebase
run: |
printf '%s' "$FIREBASE_SERVICE_ACCOUNT" > "$RUNNER_TEMP/sa.json"
export GOOGLE_APPLICATION_CREDENTIALS="$RUNNER_TEMP/sa.json"
printf 'ALCHEMY_API_KEY=%s\n' "$ALCHEMY_API_KEY" > functions/.env.aclamm
firebase deploy --only functions:stableSurgeData,functions:reclammData --project aclamm --non-interactive
env:
FIREBASE_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}