Bump direct dependencies, catalog pins, and security overrides to the latest versions the toolchain accepts, and refresh the lockfile. Move pnpm to 12.23.0 and wrangler to 4.167.0 now that workerd postinstall matches the published binary. Keep Prettier at 2.8.8 and TypeScript at 6.0.3 (@typescript-eslint still requires typescript < 6.1.0). Leave CodeMirror and Mermaid patches unchanged.
113 lines
2.8 KiB
YAML
113 lines
2.8 KiB
YAML
name: Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'doocs/md'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up pnpm
|
|
uses: pnpm/setup@v3
|
|
with:
|
|
version: 12.23.0
|
|
runtime: node@22
|
|
cache: true
|
|
install: false
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Run lint
|
|
run: pnpm run lint
|
|
|
|
- name: Determine build command
|
|
id: build-command
|
|
run: |
|
|
if [[ "${{ secrets.BUILD_COMMAND }}" == "build:h5-netlify" ]]; then
|
|
echo "BUILD_COMMAND=build:h5-netlify" >> $GITHUB_ENV
|
|
else
|
|
echo "BUILD_COMMAND=build" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Run build
|
|
run: pnpm web ${{ env.BUILD_COMMAND }}
|
|
|
|
- name: Generate CNAME
|
|
run: |
|
|
mkdir -p apps/web/dist
|
|
echo "md.doocs.org" > apps/web/dist/CNAME
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v5
|
|
with:
|
|
path: apps/web/dist
|
|
|
|
deploy-pages:
|
|
needs: build
|
|
permissions:
|
|
pages: write
|
|
id-token: write
|
|
environment:
|
|
name: github_pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v5
|
|
|
|
deploy-cloudflare:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'doocs/md'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up pnpm
|
|
uses: pnpm/setup@v3
|
|
with:
|
|
version: 12.23.0
|
|
runtime: node@22
|
|
cache: true
|
|
install: false
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build for Cloudflare Workers
|
|
run: pnpm web build:h5-netlify
|
|
env:
|
|
CF_WORKERS: 1
|
|
|
|
- name: Deploy to Cloudflare Workers
|
|
uses: cloudflare/wrangler-action@v4
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
command: deploy --name md
|
|
workingDirectory: apps/web
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
- name: Deployment Summary
|
|
run: |
|
|
echo "🚀 Deployed to Cloudflare Workers!"
|
|
echo "📍 URL: https://md.doocs.workers.dev"
|