chore: vercel sync

This commit is contained in:
DIYgod 2025-08-11 14:15:16 +08:00
parent b95bb570fb
commit 1ab16fd6f0
No known key found for this signature in database
3 changed files with 59 additions and 5 deletions

View File

@ -27,6 +27,8 @@ jobs:
cache: 'pnpm'
- name: Install dependencies (yarn)
run: pnpm i
# assets
- name: Build assets
run: pnpm build
- name: Deploy
@ -38,32 +40,70 @@ jobs:
user_email: '41898282+github-actions[bot]@users.noreply.github.com'
# prevent deleting build/test-full-routes.json which will break build:docs
keep_files: true
# docs
- name: Build docs
run: pnpm build:docs
- id: check-env
- id: check-docs-env
env:
DOCS_API_TOKEN: ${{ secrets.DOCS_API_TOKEN }}
if: ${{ env.DOCS_API_TOKEN != '' }}
run: echo "defined=true" >> $GITHUB_OUTPUT
- name: Checkout docs
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
if: steps.check-env.outputs.defined == 'true'
if: steps.check-docs-env.outputs.defined == 'true'
with:
repository: 'RSSNext/rsshub-docs'
token: ${{ secrets.DOCS_API_TOKEN }}
path: rsshub-docs
- name: Update docs
if: steps.check-env.outputs.defined == 'true'
if: steps.check-docs-env.outputs.defined == 'true'
run: |
cp -r ./assets/build/docs/en/* ./rsshub-docs/src/routes
cp -r ./assets/build/docs/zh/* ./rsshub-docs/src/zh/routes
cp ./lib/types.ts ./rsshub-docs/.vitepress/theme/types.ts
cp ./scripts/workflow/data.ts ./rsshub-docs/.vitepress/config/data.ts
- name: Commit docs
if: steps.check-env.outputs.defined == 'true'
if: steps.check-docs-env.outputs.defined == 'true'
run: |
cd rsshub-docs
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git status
git diff-index --quiet HEAD || (git commit -m "chore: auto build https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA" -a --no-verify && git push "https://${GITHUB_ACTOR}:${{ secrets.DOCS_API_TOKEN }}@github.com/RSSNext/rsshub-docs.git" HEAD:main)
# vercel
- id: check-vercel-env
env:
VERCEL_API_TOKEN: ${{ secrets.VERCEL_API_TOKEN }}
if: ${{ env.VERCEL_API_TOKEN != '' }}
run: echo "defined=true" >> $GITHUB_OUTPUT
- name: Checkout vercel
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
if: steps.check-vercel-env.outputs.defined == 'true'
with:
repository: 'RSSNext/rsshub-vercel'
token: ${{ secrets.VERCEL_API_TOKEN }}
path: rsshub-vercel
- name: Build vercel
if: steps.check-vercel-env.outputs.defined == 'true'
run: pnpm build:vercel
- name: Update vercel
if: steps.check-vercel-env.outputs.defined == 'true'
run: |
rm -rf ./rsshub-vercel/src
rm -rf ./rsshub-vercel/patches
mkdir -p ./rsshub-vercel/src
mkdir -p ./rsshub-vercel/patches
cp -r ./dist/* ./rsshub-vercel/src
cp -r ./patches/* ./rsshub-vercel/patches
cd rsshub-vercel
pnpm i
- name: Commit vercel
if: steps.check-vercel-env.outputs.defined == 'true'
run: |
cd rsshub-vercel
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git status
git diff-index --quiet HEAD || (git commit -m "chore: auto build https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA" -a --no-verify && git push "https://${GITHUB_ACTOR}:${{ secrets.VERCEL_API_TOKEN }}@github.com/RSSNext/rsshub-vercel.git" HEAD:main)

View File

@ -22,7 +22,7 @@
],
"scripts": {
"build": "tsx scripts/workflow/build-routes.ts && tsdown",
"build:vercel": "tsx scripts/workflow/build-routes.ts && tsdown --config ./tsdown-vercel.config.ts && mv dist/server.js dist/index.js",
"build:vercel": "tsx scripts/workflow/build-routes.ts && tsdown --config ./tsdown-vercel.config.ts && mv dist/server.js dist/index.js && tsx scripts/workflow/build-vercel-packagejson.ts",
"build:docs": "tsx scripts/workflow/build-docs.ts",
"dev": "cross-env NODE_ENV=dev tsx watch --inspect --clear-screen=false lib/index.ts",
"dev:cache": "cross-env NODE_ENV=production tsx watch --clear-screen=false lib/index.ts",

View File

@ -0,0 +1,14 @@
import packageJson from '../../package.json';
import fs from 'node:fs';
packageJson.name = 'rsshub-vercel';
// @ts-ignore
delete packageJson.scripts;
// @ts-ignore
delete packageJson.main;
// @ts-ignore
delete packageJson.files;
// @ts-ignore
delete packageJson['lint-staged'];
fs.writeFileSync('rsshub-vercel/package.json', JSON.stringify(packageJson, null, 4));