Skip to content

fix: only fail liveness on pod-local errors, keep RPC check on readiness #2172

fix: only fail liveness on pod-local errors, keep RPC check on readiness

fix: only fail liveness on pod-local errors, keep RPC check on readiness #2172

name: Deploy App To Feature Branch
on: pull_request
jobs:
build:
name: Build and Test App
runs-on: matterlabs-firebase-deployer
permissions:
contents: read
pull-requests: write
checks: write
defaults:
run:
working-directory: ./packages/app
outputs:
dappUrl: ${{ steps.check_channel.outputs.channel_url }}
env:
CHANNEL_NAME: pr-${{ github.event.number }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '22'
cache: 'npm'
- name: Install Firebase CLI and auth
run: |
npm install -g firebase-tools
- name: Install dependencies
working-directory: ./
run: |
npm pkg delete scripts.prepare
npm ci
- name: Lint
run: |
npm run lint -- --no-fix --max-warnings 0
- name: Test
run: npm run test:ci
- name: Type check
run: npm run typecheck
- name: Build
env:
VITE_VERSION: ${{ github.head_ref }}
run: |
npm run build
- name: Build Storybook
run: npm run build-storybook
- name: Update config
run: |
echo "window[\"##runtimeConfig\"] = { appEnvironment: \"staging\" };" > dist/config.js
- name: Check if Firebase Hosting channel exists
working-directory: ./packages/app
id: check_channel
# Using API directly as cli's hosting:channel:list/create can not be used with non-default site
run: |
CHANNEL_URL=$(curl -s -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://firebasehosting.googleapis.com/v1beta1/sites/staging-scan-v2-zksyncos/channels" | jq --arg channel_name "${CHANNEL_NAME}" -r '.channels[]|select(.name|contains($channel_name)) | .url')
echo $CHANNEL_URL
if [ -z "$CHANNEL_URL" ]; then
echo "New channel"
curl -s -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" "https://firebasehosting.googleapis.com/v1beta1/sites/staging-scan-v2-zksyncos/channels?channelId=$CHANNEL_NAME"
CHANNEL_URL=$(curl -s -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://firebasehosting.googleapis.com/v1beta1/sites/staging-scan-v2-zksyncos/channels" | jq --arg channel_name "${CHANNEL_NAME}" -r '.channels[]|select(.name|contains($channel_name)) | .url')
fi
echo "channel_url=${CHANNEL_URL}" >> $GITHUB_OUTPUT
- name: Deploy
working-directory: ./packages/app
run: |
firebase --project staging-scan-v2 hosting:channel:deploy ${{ env.CHANNEL_NAME }} --expires 7d
- name: Publish preview url
if: github.event.pull_request.head.repo.full_name == github.repository
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
comment_tag: preview_url
message: |
Visit the preview URL for this PR:
${{ steps.check_channel.outputs.channel_url }}
mainnet:
needs: build
name: Feature on Mainnet + Sepolia
uses: ./.github/workflows/app-e2e.yml
secrets: inherit
permissions:
contents: write
with:
targetUrl: ${{ needs.build.outputs.dappUrl }}
testnet_network_value_for_e2e: "/?network=zksync-os-testnet-alpha"
default_network_value_for_e2e: "/?network=zksync-os-mainnet"
publish_to_allure: true
environmentTags: "and not @productionEnv"