100 lines
2.2 KiB
YAML
100 lines
2.2 KiB
YAML
name: Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
pull_request:
|
|
branches: ["main"]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- id: commit-hash
|
|
uses: prompt/actions-commit-hash@v3
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
|
|
- name: Install Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Check Linting
|
|
run: bun run lint
|
|
|
|
- name: Check Format
|
|
run: bun run format
|
|
|
|
- name: Run Unit Tests
|
|
run: bun run test
|
|
|
|
- name: Playgroud build check
|
|
run: bun run build
|
|
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: build-output-${{ steps.commit-hash.outputs.short }}
|
|
path: .output/public
|
|
retention-days: 7
|
|
|
|
- name: Playgroud generate check
|
|
run: bun run generate
|
|
|
|
- name: Upload generate artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: generate-output-${{ steps.commit-hash.outputs.short }}
|
|
path: dist
|
|
retention-days: 7
|
|
|
|
- name: Cache node modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
node_modules
|
|
~/.bun/install/cache
|
|
key: ${{ runner.os }}-build-${{ hashFiles('**/bun.lock') }}
|
|
|
|
deploy:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event_name == 'push' }}
|
|
|
|
steps:
|
|
- id: commit-hash
|
|
uses: prompt/actions-commit-hash@v3
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download generate artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: generate-output-${{ steps.commit-hash.outputs.short }}
|
|
path: artifact
|
|
|
|
- name: List artifact contents
|
|
run: |
|
|
echo "Contents:" && ls -la artifact || true
|
|
|
|
- name: Install Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
|
|
- name: Prepare deployment
|
|
run: |
|
|
bun install -g edgeone vercel wrangler
|
|
|
|
- name: Deploy to Vercel
|
|
run: |
|
|
vercel --token ${{ secrets.VERCEL_TOKEN }} --prod --yes
|