refactor: migrate to TypeScript with Vitest and modern tooling #160
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: example - next.js | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - feature/* | |
| pull_request_target: | |
| jobs: | |
| static: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.15.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - run: | | |
| pnpm install --frozen-lockfile | |
| pnpm exec vercel pull --yes --token=${VERCEL_TOKEN} | |
| working-directory: example/nextjs | |
| env: | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_NEXTJS }} | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| - run: | | |
| pnpm exec vercel build | |
| if: github.event_name == 'pull_request_target' | |
| working-directory: example/nextjs | |
| env: | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_NEXTJS }} | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| - uses: ./ | |
| id: now-deployment-staging | |
| if: github.event_name == 'pull_request_target' | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
| vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
| vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_NEXTJS }} | |
| vercel-args: --prebuilt | |
| working-directory: example/nextjs | |
| alias-domains: | | |
| staging.nextjs.vercel-action.amond.dev | |
| pr-{{PR_NUMBER}}.nextjs.vercel-action.amond.dev | |
| - name: production or not | |
| id: prod_or_not | |
| run: | | |
| if [ "$REF" == 'refs/heads/master' ] | |
| then | |
| echo "vercel-args=--prod --prebuilt" >> $GITHUB_OUTPUT | |
| else | |
| echo "vercel-args=--prebuilt" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| REF: ${{ github.ref }} | |
| - run: | | |
| pnpm exec vercel build --prod | |
| if: github.event_name == 'push' | |
| working-directory: example/nextjs | |
| env: | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_NEXTJS }} | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| - uses: ./ | |
| id: now-deployment-production | |
| if: github.event_name == 'push' | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
| vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
| vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_NEXTJS }} | |
| vercel-args: ${{ steps.prod_or_not.outputs.vercel-args }} | |
| working-directory: example/nextjs | |
| alias-domains: | | |
| {{BRANCH}}.nextjs.vercel-action.amond.dev |