Skip to content

Merge branch 'feature' into develop #24

Merge branch 'feature' into develop

Merge branch 'feature' into develop #24

name: Build and Deploy to GitHub Pages
on:
push:
branches: ["develop"]
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout scratch-gui
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install dependencies
run: |
rm -f pnpm-lock.yaml
pnpm install
- name: Generate files
run: npm run prepublish
- name: Build
run: NODE_ENV=production npm run build
- name: Checkout astraeditor.github.io
uses: actions/checkout@v4
with:
repository: AstraEditor/astraeditor.github.io
token: ${{ secrets.DEPLOY_TOKEN }}
path: gh-pages
- name: Deploy to online directory
run: |
cd gh-pages
# 清空 online 目录(保留 .git)
find online -mindepth 1 -delete
# 复制构建产物
cp -r $GITHUB_WORKSPACE/build/* online/
# 提交
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git diff --quiet && git diff --staged --quiet || \
git commit -m "New Release Version from scratch-gui ${GITHUB_SHA:0:7}"
git push