mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-16 05:10:34 +00:00
Replaces 'pnpm i' with 'pnpm i --no-frozen-lockfile' in build and release GitHub workflows to allow installation even if lockfile changes are detected. This helps prevent CI failures due to lockfile mismatches.
95 lines
3.2 KiB
YAML
95 lines
3.2 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 --no-frozen-lockfile
|
|
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 --no-frozen-lockfile
|
|
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
|