Skip to content

fix: retry fixing get_settings rate limit issue (#85) #6

fix: retry fixing get_settings rate limit issue (#85)

fix: retry fixing get_settings rate limit issue (#85) #6

name: Deploy Staging
# Staging deployment workflow triggered by main branch pushes
on:
push:
branches:
- main
# Specific permissions granted only where needed
permissions:
contents: read # Required for checkout
packages: read # Required for package installation
pull-requests: write
deployments: write
id-token: write # Important for OIDC token generation
# Ensure only one staging deployment can run at a time
concurrency:
group: staging
cancel-in-progress: false
env:
NODE_ENV: staging
HUSKY: 0 # Disabled to prevent git hooks during CI
jobs:
deploy:
name: Deploy Staging
runs-on: ubuntu-latest
timeout-minutes: 15 # Prevent hanging deployments
environment:
name: staging
url: ${{ steps.preview-url.outputs.url }}
permissions:
deployments: write
statuses: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup-environment
- name: Deploy to Vercel
id: deploy
timeout-minutes: 10
uses: ./.github/actions/deploy/vercel/staging
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
sha: ${{ github.sha }}
- name: Generate App ID
id: generate-app-id
uses: ./.github/actions/generate-app-id
with:
vercel_preview_url: ${{ steps.deploy.outputs.deployment-url }}
deriv_api_token: ${{ secrets.DERIV_API_TOKEN }}
deriv_app_id: ${{ secrets.DERIV_APP_ID }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare staging URL
id: preview-url
uses: ./.github/actions/prepare-preview-url
with:
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
app-id: ${{ steps.generate-app-id.outputs.app-id }}
# Cleanup old deployments
- name: Cleanup old deployments
if: always()
run: |
if [ ! -z "${{ steps.deploy.outputs.deployment-url }}" ]; then
echo "Cleaning up old deployments..."
curl -X DELETE \
-H "Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}" \
"https://api.vercel.com/v13/deployments/${{ steps.deploy.outputs.deployment-id }}"
fi
- name: Update deployment status
uses: ./.github/actions/deployment-status
if: success()
with:
environment: 'staging'
deployment-url: ${{ steps.preview-url.outputs.url }}
sha: ${{ github.sha }}
status: 'success'
description: '🚀 Staging deployment completed'
- name: Handle deployment failure
if: failure()
uses: ./.github/actions/deployment-status
with:
environment: 'staging'
deployment-url: ${{ steps.preview-url.outputs.url }}
sha: ${{ github.sha }}
status: 'failure'
description: '❌ Staging deployment failed'