-
Notifications
You must be signed in to change notification settings - Fork 7
65 lines (55 loc) · 2.33 KB
/
release.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
name: CI
on:
push:
branches:
- "main"
tags: ["*"]
jobs:
cicd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v2
with:
node-version: "16"
- name: Install dependencies
run: npm ci
- name: Run Tests
run: npm run test
# Just checking if build succeeds.
- name: Build
env:
STATIC_FILE_ORIGIN: https://saturn-test.network
L1_ORIGIN: https://l1s.saturn-test.ms
TRUSTED_L1_ORIGIN: https://saturn-test.ms
LOG_INGESTOR_URL: https://p6wofrb2zgwrf26mcxjpprivie0lshfx.lambda-url.us-west-2.on.aws
JWT_AUTH_URL: https://fz3dyeyxmebszwhuiky7vggmsu0rlkoy.lambda-url.us-west-2.on.aws/
ORCHESTRATOR_URL: https://orchestrator.strn-test.pl/nodes?maxNodes=100
run: npm run build
- name: Set Staging Environment Variables
if: github.ref_type != 'tag'
run: |
echo "FLEEK_SITE_SLUG=saturn-staging" >> $GITHUB_ENV
- name: Set Production Environment Variables
if: github.ref_type == 'tag'
run: |
echo "FLEEK_SITE_SLUG=saturn-tech" >> $GITHUB_ENV
# Trigger fleek homepage deploy, which will build and host the browser-client files.
- name: Deploy
run: |
siteJson=$(
curl -sS https://api.fleek.co/graphql -H "Authorization: ${{secrets.FLEEK_HOSTING_API_KEY}}" \
-H "Content-Type: application/json" \
-d '{ "query": "query { getSiteBySlug(slug: \"'"$FLEEK_SITE_SLUG"'\") { id publishedDeploy { id } }}" }'
)
siteId=$(echo $siteJson | jq --raw-output '.data.getSiteBySlug.id')
latestDeployId=$(echo $siteJson | jq --raw-output '.data.getSiteBySlug.publishedDeploy.id')
echo "siteSlug=$FLEEK_SITE_SLUG"
echo "siteId=$siteId"
echo "latestDeployId=$latestDeployId"
# Retry deploy will cause fleek to download the latest browser-client, while also
# keeping the currently deployed homepage version.
curl -sS -H "Authorization: ${{secrets.FLEEK_HOSTING_API_KEY}}" \
-H "Content-Type: application/json" \
-d '{ "query": "mutation { retryDeploy(siteId: \"'"$siteId"'\", deployId: \"'"$latestDeployId"'\") { id status } }" }' \
https://api.fleek.co/graphql | jq