mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-19 05:05:44 +08:00
- Fix grammatical error in Chinese text (release-info.md) - Use jq for reliable JSON parsing instead of grep with Perl regex - Improve error handling with clearer warning messages Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
187 lines
5.7 KiB
YAML
187 lines
5.7 KiB
YAML
name: "Build Release"
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
permissions: write-all
|
|
|
|
jobs:
|
|
check-version:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Clone Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: main
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract version from tag
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
|
|
|
- name: Use Node.js 20.X
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20.x
|
|
|
|
- name: Check Version
|
|
run: |
|
|
ls
|
|
node ./script/checkVersion.cjs
|
|
sh ./checkVersion.sh
|
|
Build-LiteLoader:
|
|
needs: [check-version]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Clone Main Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: 'NapNeko/NapCatQQ'
|
|
submodules: true
|
|
ref: main
|
|
token: ${{ secrets.NAPCAT_BUILD }}
|
|
- name: Use Node.js 20.X
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20.x
|
|
|
|
- name: Build NuCat Framework
|
|
run: |
|
|
npm i
|
|
cd napcat.webui
|
|
npm i
|
|
cd ..
|
|
npm run build:framework
|
|
cd dist
|
|
npm i --omit=dev
|
|
cd ..
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: NapCat.Framework
|
|
path: dist
|
|
Build-Shell:
|
|
runs-on: ubuntu-latest
|
|
needs: [check-version]
|
|
steps:
|
|
- name: Clone Main Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: 'NapNeko/NapCatQQ'
|
|
submodules: true
|
|
ref: main
|
|
token: ${{ secrets.NAPCAT_BUILD }}
|
|
|
|
- name: Use Node.js 20.X
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20.x
|
|
|
|
- name: Build NuCat Shell
|
|
run: |
|
|
npm i
|
|
cd napcat.webui
|
|
npm i
|
|
cd ..
|
|
npm run build:shell
|
|
cd dist
|
|
npm i --omit=dev
|
|
cd ..
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: NapCat.Shell
|
|
path: dist
|
|
|
|
release-napcat:
|
|
needs: [Build-LiteLoader,Build-Shell]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Clone Main Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: 'NapNeko/NapCatQQ'
|
|
submodules: true
|
|
ref: main
|
|
token: ${{ secrets.NAPCAT_BUILD }}
|
|
|
|
- name: Download All Artifact
|
|
uses: actions/download-artifact@v4
|
|
|
|
- name: Compress subdirectories
|
|
run: |
|
|
cd ./NapCat.Shell/
|
|
zip -q -r NapCat.Shell.zip *
|
|
cd ..
|
|
cd ./NapCat.Framework/
|
|
zip -q -r NapCat.Framework.zip *
|
|
cd ..
|
|
rm ./NapCat.Shell.zip -rf
|
|
rm ./NapCat.Framework.zip -rf
|
|
mv ./NapCat.Shell/NapCat.Shell.zip ./
|
|
mv ./NapCat.Framework/NapCat.Framework.zip ./
|
|
|
|
mkdir ./NapCat.Framework.Windows.Once
|
|
unzip -q ./external/LiteLoaderWrapper.zip -d ./NapCat.Framework.Windows.Once
|
|
cd ./NapCat.Framework.Windows.Once
|
|
ls
|
|
mkdir -p ./LL/plugins/NapCatQQ
|
|
unzip -q ../NapCat.Framework.zip -d ./LL/plugins/NapCatQQ
|
|
zip -q -r NapCat.Framework.Windows.Once.zip *
|
|
cd ..
|
|
mv ./NapCat.Framework.Windows.Once/NapCat.Framework.Windows.Once.zip ./
|
|
- name: Extract version from tag
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
|
|
|
- name: Download Windows OneKey Packages
|
|
run: |
|
|
# Get latest release tag using jq for reliable JSON parsing
|
|
LATEST_RELEASE=$(curl -s https://api.github.com/repos/NapNeko/NapCatQQ/releases/latest | jq -r '.tag_name')
|
|
echo "Latest release: $LATEST_RELEASE"
|
|
|
|
# Download OneKey packages if they exist (non-zero exit code won't fail the step)
|
|
curl -f -L -o NapCat.Shell.Windows.OneKey.zip "https://github.com/NapNeko/NapCatQQ/releases/download/$LATEST_RELEASE/NapCat.Shell.Windows.OneKey.zip" || echo "Warning: NapCat.Shell.Windows.OneKey.zip not found in latest release"
|
|
curl -f -L -o NapCat.Framework.Windows.OneKey.zip "https://github.com/NapNeko/NapCatQQ/releases/download/$LATEST_RELEASE/NapCat.Framework.Windows.OneKey.zip" || echo "Warning: NapCat.Framework.Windows.OneKey.zip not found in latest release"
|
|
|
|
- name: Generate Release Notes
|
|
run: |
|
|
# Create header with version
|
|
echo "# V${{ env.VERSION }} Refactor" > RELEASE_NOTES.md
|
|
|
|
# Add fixed release information
|
|
cat .github/release-template/release-info.md >> RELEASE_NOTES.md
|
|
|
|
# Add changelog section
|
|
echo "" >> RELEASE_NOTES.md
|
|
chmod +x ./script/generate-changelog.sh
|
|
./script/generate-changelog.sh >> RELEASE_NOTES.md
|
|
|
|
- name: Create Release Draft and Upload Artifacts
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
name: NapCat V${{ env.VERSION }}
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
body_path: RELEASE_NOTES.md
|
|
files: |
|
|
NapCat.Framework.zip
|
|
NapCat.Shell.zip
|
|
NapCat.Framework.Windows.Once.zip
|
|
NapCat.Shell.Windows.OneKey.zip
|
|
NapCat.Framework.Windows.OneKey.zip
|
|
draft: true
|
|
|
|
build-docker:
|
|
needs: release-napcat
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Dispatch Docker Build
|
|
run: |
|
|
curl -X POST \
|
|
-H "Authorization: Bearer ${{ secrets.NAPCAT_BUILD }}" \
|
|
-H "Accept: application/vnd.github.v3+json" \
|
|
https://api.github.com/repos/NapNeko/NapCat-Docker/actions/workflows/docker-publish.yml/dispatches \
|
|
-d '{"ref": "main"}'
|