Merge branch 'master' of github.com:ryanuo/blazeB2 #19
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: Build and Deploy | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Configure pnpm global bin directory | |
run: | | |
mkdir -p ~/.pnpm-global | |
pnpm config set global-bin-dir ~/.pnpm-global | |
- name: Add pnpm global bin to PATH | |
run: echo "$HOME/.pnpm-global" >> $GITHUB_PATH | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build project | |
run: pnpm run build | |
- name: Remove old static files | |
run: | | |
rm -rf deploys/vercel-api/api/static | |
rm -rf deploys/other/static | |
- name: Copy dist files | |
run: | | |
mkdir -p deploys/vercel-api/api/static | |
mkdir -p deploys/other/static | |
cp -r dist/* deploys/vercel-api/api/static | |
cp -r dist/* deploys/other/static | |
- name: Commit and Push Changes | |
run: | | |
git config --global user.email "1577791638@qq.com" | |
git config --global user.name "ryanuo" | |
git add . | |
git diff-index --quiet HEAD || git commit -m "chore: auto update deploy static files;" | |
git push |