Update README.md #14
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: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: "9.15.1" | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Setup pnpm cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Type check | |
run: pnpm typecheck | |
- name: Lint | |
run: pnpm lint | |
- name: Format check | |
run: pnpm format:check | |
- name: Build | |
run: pnpm build | |
env: | |
VITE_PUBLIC_PEXELS_API_KEY: ${{ secrets.VITE_PUBLIC_PEXELS_API_KEY }} | |
VITE_API_URL: ${{ secrets.VITE_API_URL }} | |
- name: Test preview build | |
run: | | |
pnpm preview & | |
sleep 5 | |
curl -f http://localhost:4173 | |
deploy: | |
needs: build | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: "9.15.1" | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
run: pnpm build | |
env: | |
VITE_PUBLIC_PEXELS_API_KEY: ${{ secrets.VITE_PUBLIC_PEXELS_API_KEY }} | |
# TODO: vercel deployment: | |
# - name: Deploy to Vercel | |
# 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 }} | |
# vercel-args: '--prod' |