Skip to content

Merge pull request #31 from filecoin-saturn/cid-detection #60

Merge pull request #31 from filecoin-saturn/cid-detection

Merge pull request #31 from filecoin-saturn/cid-detection #60

Workflow file for this run

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