Merge pull request #559 from gn-t-k/improve/pr-create-retrospective-hook #237
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: Production Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| name: Deploy to Vercel (Production) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup workspace | |
| uses: ./.github/actions/setup-workspace | |
| - name: Pull Vercel Environment | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| run: | | |
| npx vercel pull --yes --environment=production --token=$VERCEL_TOKEN | |
| - name: Check Environment Variables | |
| run: | | |
| # Vercel から取得した環境変数を読み込む | |
| set -a | |
| source .vercel/.env.production.local | |
| set +a | |
| # デプロイ前に環境変数を検証 | |
| pnpm --filter @next-lift/env check || { | |
| echo "::error::環境変数の検証に失敗しました。Vercelの環境変数設定を確認してください。" | |
| exit 1 | |
| } | |
| - name: Run Database Migration | |
| run: | | |
| # Vercel から取得した環境変数を読み込んでマイグレーションを実行 | |
| set -a | |
| source .vercel/.env.production.local | |
| set +a | |
| cd packages/authentication | |
| pnpm migration:apply | |
| echo "Migration completed successfully" | |
| - name: Deploy to Vercel | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| run: | | |
| npx vercel deploy --prod --archive=tgz --token=$VERCEL_TOKEN > deployment-url.txt | |
| echo "DEPLOYMENT_URL=$(cat deployment-url.txt)" >> $GITHUB_ENV |