add ci workflows #1
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: Deploy to Vercel | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: "Vercel environment to pull (preview or production)" | |
| required: false | |
| default: "preview" | |
| pull_request: | |
| branches: | |
| - "**" | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| env: | |
| APP_DIR: mdk-nextjs-demo | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: ${{ env.APP_DIR }}/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: ${{ env.APP_DIR }} | |
| - name: Lint demo | |
| run: npm run lint | |
| working-directory: ${{ env.APP_DIR }} | |
| - name: Build demo | |
| run: npm run build | |
| working-directory: ${{ env.APP_DIR }} | |
| - name: Pull Vercel environment settings | |
| run: npx vercel pull --yes --environment=${{ inputs.environment || 'preview' }} --token=$VERCEL_TOKEN | |
| working-directory: ${{ env.APP_DIR }} | |
| env: | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| - name: Deploy to Vercel | |
| run: npx vercel deploy --prod --yes --token=$VERCEL_TOKEN | |
| working-directory: ${{ env.APP_DIR }} | |
| env: | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} |