-
Notifications
You must be signed in to change notification settings - Fork 289
37 lines (37 loc) · 1.4 KB
/
deploy_vercel.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
name: Osmosis Front-End Deployment
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check latest commit matches API
id: check_commit
run: |
MAX_RETRIES=5
RETRY_COUNT=0
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
LATEST_COMMIT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/commits/main | jq -r '.sha')
if [ "$LATEST_COMMIT" != "" ]; then
echo "Latest commit: $LATEST_COMMIT"
echo "Workflow commit: ${{ github.sha }}"
if [ "$LATEST_COMMIT" != "${{ github.sha }}" ]; then
echo "The workflow commit and the latest commit do not match."
exit 1
fi
exit 0
fi
RETRY_COUNT=$((RETRY_COUNT+1))
echo "Failed to fetch latest commit, retrying ($RETRY_COUNT/$MAX_RETRIES)..."
sleep 5
done
echo "Failed to fetch latest commit after $MAX_RETRIES attempts."
exit 1
- name: Deploy preview
run: curl -X POST ${{ secrets.VERCEL_WEBHOOK_DEPLOY_STAGE }}
- name: Deploy testnet
run: curl -X POST ${{ secrets.VERCEL_WEBHOOK_DEPLOY_TESTNET }}
- name: Deploy production
run: curl -X POST ${{ secrets.VERCEL_WEBHOOK_DEPLOY_PRODUCTION }}