Skip to content

Update deploy.yml

Update deploy.yml #122

Workflow file for this run

name: deploy
on:
workflow_dispatch:
push:
branches:
- master
env:
DB_TYPE: ${{ secrets.DB_TYPE }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_DATABASE: ${{ secrets.DB_DATABASE }}
DB_RETRY_DELAY: ${{ secrets.DB_RETRY_DELAY }}
DB_RETRY_ATTEMPTS: ${{ secrets.DB_RETRY_ATTEMPTS }}
WRITE_SWAGGER: ${{ secrets.WRITE_SWAGGER }}
RUNNING_ENV: ${{ secrets.RUNNING_ENV }}
POSTGRES_URL: ${{ secrets.POSTGRES_URL }}
POSTGRES_PRISMA_URL: ${{ secrets.POSTGRES_PRISMA_URL }}
POSTGRES_URL_NON_POOLING: ${{ secrets.POSTGRES_URL_NON_POOLING }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DATABASE: ${{ secrets.POSTGRES_DATABASE }}
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🚀
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 0
- name: Install pnpm 🚀
uses: pnpm/[email protected]
id: pnpm-install
with:
version: 7
run_install: false
# - name: Cache pnpm dependencies 🚀
# uses: actions/cache@v2
# id: pnpm-cache
# with:
# path: ~/.pnpm-store
# key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
# restore-keys: |
# ${{ runner.os }}-pnpm-
- name: Install dependencies 🚀
if: steps.pnpm-cache.outputs.cache-hit != 'true'
run: pnpm update && pnpm install --no-frozen-lockfile
- name: Setup Node.js 🚀
uses: actions/setup-node@v3
with:
node-version: 18
- name: Build project 🚀
env:
NODE_OPTIONS: --max_old_space_size=4096
run: pnpm run build
- name: Deploy to Vercel 🚀
run: npx vercel --token ${VERCEL_TOKEN} --prod
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
# vercel-args: '--prod' #Optional
# github-token: ${{ secrets.GIT_TOKEN }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Deploy to nestjs.h7ml.cn 🚀
uses: amondnet/vercel-action@v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
github-token: ${{ secrets.GIT_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
vercel-args: '--prod'
github-comment: false
alias-domains: |
nestjs.h7ml.cn