Next Build Deploy Test Push #114
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: Next Build Deploy Test Push | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| GH_TOKEN: ${{secrets.PULL_REQ}} | |
| on: | |
| schedule: | |
| - cron: "0 0 * * 0" # Runs every Sunday at midnight | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # Give the default GITHUB_TOKEN write permission to commit and push the | |
| # added or changed files to the repository. | |
| contents: write | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: eelab-dev/EEcircuit | |
| - name: Update Dependencies | |
| run: npx --yes npm-check-updates -u | |
| - name: Install Dependencies | |
| run: npm install | |
| - name: Update engine to next version | |
| run: npm install eecircuit-engine@next | |
| - name: Pull Vercel env | |
| env: | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| run: npx vercel pull --yes --token "$VERCEL_TOKEN" | |
| - name: Build Local for Vercel | |
| env: | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| run: npx vercel build --prod --token "$VERCEL_TOKEN" | |
| - name: Deploy to Vercel | |
| id: deploy | |
| env: | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| url=$(npx vercel deploy --prebuilt --prod --token "$VERCEL_TOKEN") | |
| echo "url=$url" >> "$GITHUB_OUTPUT" | |
| - name: Alias deployment | |
| if: ${{ steps.deploy.outputs.url != '' }} | |
| env: | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| run: npx vercel alias "${{ steps.deploy.outputs.url }}" next.eecircuit.com --scope danchitnis-projects --token "$VERCEL_TOKEN" | |
| - name: check deployment | |
| run: curl -s https://next.eecircuit.com | head -n 50 | |
| - name: Install Playwright Browsers | |
| run: npx playwright install --with-deps | |
| - name: Run Playwright tests | |
| run: npx playwright test -g "EEcircuit Next" | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 30 |