Skip to content

Commit 5f7a94c

Browse files
committed
fix: use firebase API to list and create channels
1 parent 962a628 commit 5f7a94c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

.github/workflows/app-deploy-feature-branch.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,21 @@ jobs:
6363
- name: Check if Firebase Hosting channel exists
6464
working-directory: ./packages/app
6565
id: check_channel
66+
# Using API directly as cli's hosting:channel:list/create can not be used with non-default site
6667
run: |
6768
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')
6869
echo $CHANNEL_URL
6970
if [ -z "$CHANNEL_URL" ]; then
7071
echo "New channel"
71-
firebase --project staging-scan-v2 hosting:channel:create $CHANNEL_NAME
72-
CHANNEL_URL=$(firebase --project staging-scan-v2 hosting:channel:list --json | jq --arg channel_name "${CHANNEL_NAME}" -r '.result.channels[]|select(.name|contains($channel_name)) | .url')
72+
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"
73+
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')
7374
fi
7475
echo "channel_url=${CHANNEL_URL}" >> $GITHUB_OUTPUT
7576
7677
- name: Deploy
7778
working-directory: ./packages/app
7879
run: |
79-
firebase --project staging-scan-v2 hosting:channel:deploy ${{ env.CHANNEL_NAME }} --only staging-scan-v2
80+
firebase --project staging-scan-v2 hosting:channel:deploy ${{ env.CHANNEL_NAME }}
8081
8182
- name: Publish preview url
8283
if: github.event.pull_request.head.repo.full_name == github.repository

0 commit comments

Comments
 (0)