π· update Github action #2
Workflow file for this run
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: Vercel Preview Deployment | ||
env: | ||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | ||
on: | ||
push: | ||
branches-ignore: | ||
- main | ||
jobs: | ||
init: | ||
name: Initial common steps | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ποΈ Checkout | ||
uses: actions/checkout@v3 | ||
- name: βοΈ Setup PNPM | ||
uses: pnpm/action-setup@v2.2.1 | ||
with: | ||
version: 8 | ||
- name: π Cache dependencies | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: deps-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
- name: π§ Install dependencies | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
run: pnpm install --frozen-lockfile | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
needs: init | ||
- name: ποΈ Checkout | ||
uses: actions/checkout@v3 | ||
- name: βοΈ Setup PNPM | ||
uses: pnpm/action-setup@v2.2.1 | ||
with: | ||
version: 8 | ||
- name: π Cache dependencies | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: deps-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
- name: π§ Install dependencies | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
run: pnpm install --frozen-lockfile | ||
- name: π§ͺ Test | ||
run: pnpm test | ||
preview: | ||
name: Deploy preview | ||
runs-on: ubuntu-latest | ||
environment: Preview | ||
timeout-minutes: 10 | ||
needs: test | ||
steps: | ||
- name: ποΈ Checkout | ||
uses: actions/checkout@v3 | ||
- name: π§ Install Vercel CLI | ||
run: npm install --global vercel@latest | ||
- name: π Pull Vercel Environment Information | ||
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} | ||
- name: π· Build Project Artifacts | ||
run: vercel build --token=${{ secrets.VERCEL_TOKEN }} | ||
- name: π Deploy Project Artifacts to Vercel | ||
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} |