feat: add github action ci #1
This file contains 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: CI | |
on: [push, pull_request] | |
jobs: | |
vercel: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Cache Dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ~/.bun | |
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | |
restore-keys: ${{ runner.os }}-bun- | |
- name: Install Bun | |
run: | | |
curl -fsSL https://bun.sh/install | bash | |
- name: Build | |
run: | | |
bun install | |
bun run bundle | |
- name: Run Tests Locally | |
run: bun test | |
- name: Deploy to Staging | |
id: deploy-vercel-staging | |
uses: amondnet/vercel-action@v20 | |
with: | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_TL_ENGINE }} | |
scope: ${{ secrets.VERCEL_ORG_ID }} | |
- name: Run Tests Against Vercel | |
env: | |
VERCEL_URL: ${{ steps.deploy-vercel-staging.outputs.preview-url }} | |
run: bun run test | |
- name: Deploy to Production | |
uses: amondnet/vercel-action@v20 | |
id: deploy-vercel-production | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
with: | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_TL_ENGINE }} | |
vercel-args: --prod | |
scope: ${{ secrets.VERCEL_ORG_ID }} |