mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-07 19:49:01 +08:00
Replaces legacy tag fetching logic in napcat-common with a new mirror.ts module that centralizes GitHub mirror configuration, selection, and tag retrieval. Updates helper.ts to use the new mirror system and semver comparison, and exports compareSemVer for broader use. Updates workflows and scripts to generate and propagate build version information, and improves build status comment formatting for PRs. Also updates release workflow to use a new OpenAI key and model.
95 lines
3.1 KiB
YAML
95 lines
3.1 KiB
YAML
name: Build NapCat Artifacts
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions: write-all
|
|
|
|
jobs:
|
|
Build-Framework:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Clone Main Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # 需要完整历史来获取 tags
|
|
- name: Use Node.js 20.X
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20.x
|
|
- name: Generate Version
|
|
run: |
|
|
# 获取最近的 release tag (格式: vX.X.X)
|
|
LATEST_TAG=$(git describe --tags --abbrev=0 --match "v[0-9]*.[0-9]*.[0-9]*" 2>/dev/null || echo "v0.0.0")
|
|
# 去掉 v 前缀
|
|
BASE_VERSION="${LATEST_TAG#v}"
|
|
SHORT_SHA="${GITHUB_SHA::7}"
|
|
VERSION="${BASE_VERSION}-main.${{ github.run_number }}+${SHORT_SHA}"
|
|
echo "NAPCAT_VERSION=${VERSION}" >> $GITHUB_ENV
|
|
echo "Latest tag: ${LATEST_TAG}"
|
|
echo "Build version: ${VERSION}"
|
|
- name: Build NapCat.Framework
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
NAPCAT_VERSION: ${{ env.NAPCAT_VERSION }}
|
|
run: |
|
|
npm i -g pnpm
|
|
pnpm i
|
|
pnpm run typecheck || exit 1
|
|
pnpm test || exit 1
|
|
pnpm --filter napcat-webui-frontend run build || exit 1
|
|
pnpm run build:framework
|
|
mv packages/napcat-framework/dist framework-dist
|
|
cd framework-dist
|
|
npm install --omit=dev
|
|
rm ./package-lock.json || exit 0
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: NapCat.Framework
|
|
path: framework-dist
|
|
Build-Shell:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Clone Main Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # 需要完整历史来获取 tags
|
|
- name: Use Node.js 20.X
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20.x
|
|
- name: Generate Version
|
|
run: |
|
|
# 获取最近的 release tag (格式: vX.X.X)
|
|
LATEST_TAG=$(git describe --tags --abbrev=0 --match "v[0-9]*.[0-9]*.[0-9]*" 2>/dev/null || echo "v0.0.0")
|
|
# 去掉 v 前缀
|
|
BASE_VERSION="${LATEST_TAG#v}"
|
|
SHORT_SHA="${GITHUB_SHA::7}"
|
|
VERSION="${BASE_VERSION}-main.${{ github.run_number }}+${SHORT_SHA}"
|
|
echo "NAPCAT_VERSION=${VERSION}" >> $GITHUB_ENV
|
|
echo "Latest tag: ${LATEST_TAG}"
|
|
echo "Build version: ${VERSION}"
|
|
- name: Build NapCat.Shell
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
NAPCAT_VERSION: ${{ env.NAPCAT_VERSION }}
|
|
run: |
|
|
npm i -g pnpm
|
|
pnpm i
|
|
pnpm run typecheck || exit 1
|
|
pnpm test || exit 1
|
|
pnpm --filter napcat-webui-frontend run build || exit 1
|
|
pnpm run build:shell
|
|
mv packages/napcat-shell/dist shell-dist
|
|
cd shell-dist
|
|
npm install --omit=dev
|
|
rm ./package-lock.json || exit 0
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: NapCat.Shell
|
|
path: shell-dist
|