feat: add webhook handler for subscription activation and cancellatio… #343
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Vercel Platform Production Deployment | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PLATFORM_PROJECT_ID }} | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.PRODUCTION_SUPABASE_URL }} | |
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.PRODUCTION_SUPABASE_ANON_KEY }} | |
SUPABASE_SERVICE_KEY: ${{ secrets.PRODUCTION_SUPABASE_SERVICE_KEY }} | |
on: | |
push: | |
branches: | |
- production | |
workflow_dispatch: | |
jobs: | |
Deploy-Production: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Check for newer commits | |
id: check_commits | |
run: | | |
git fetch origin production || { echo "Remote branch not found, continuing with build"; echo "skip_build=false" >> $GITHUB_OUTPUT; exit 0; } | |
LATEST_COMMIT=$(git rev-parse origin/production 2>/dev/null || echo "") | |
CURRENT_COMMIT=${GITHUB_SHA} | |
if [ -n "$LATEST_COMMIT" ] && [ "$LATEST_COMMIT" != "$CURRENT_COMMIT" ]; then | |
echo "Newer commit found on production branch. Skipping build." | |
echo "skip_build=true" >> $GITHUB_OUTPUT | |
else | |
echo "This is the latest commit. Proceeding with build." | |
echo "skip_build=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Cache turbo build setup | |
if: steps.check_commits.outputs.skip_build != 'true' | |
uses: actions/cache@v4 | |
with: | |
path: .turbo | |
key: ${{ runner.os }}-turbo-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-turbo- | |
- name: Setup bun | |
if: steps.check_commits.outputs.skip_build != 'true' | |
uses: oven-sh/setup-bun@v2 | |
- name: Use Node.js 24 | |
if: steps.check_commits.outputs.skip_build != 'true' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 24 | |
- name: Install dependencies | |
if: steps.check_commits.outputs.skip_build != 'true' | |
run: bun install | |
- name: Install Vercel CLI | |
if: steps.check_commits.outputs.skip_build != 'true' | |
run: bun install --global vercel@latest | |
- name: Pull Vercel Environment Information | |
if: steps.check_commits.outputs.skip_build != 'true' | |
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts | |
if: steps.check_commits.outputs.skip_build != 'true' | |
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Deploy Project Artifacts to Vercel | |
if: steps.check_commits.outputs.skip_build != 'true' | |
run: vercel deploy --archive=tgz --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} |