Skip to content

ci(publish): fix Windows build artifact copy path #318

ci(publish): fix Windows build artifact copy path

ci(publish): fix Windows build artifact copy path #318

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build-and-release:
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: |
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
npm install
cd src/webui/FE
npm install
- name: Build
run: |
npm run build
npm run build-webui
- name: Compress dist
run: |
sudo apt install zip -y
cd ./dist/
zip -r ../LLBot.zip ./*
- name: Compress for Windows Cli
run: |
mkdir llbot-cli-win-x64
cd llbot-cli-win-x64
mkdir -p bin/llbot
cp ../dist/使用说明.txt ./
cp ../dist/更新日志.txt ./
cp -r ../dist/* bin/llbot/
wget https://github.com/linyuchen/PMHQ/releases/latest/download/pmhq-win-x64.zip
unzip pmhq-win-x64.zip
mkdir -p bin/pmhq
rm pmhq-win-x64.zip
mv pmhq-win-x64.exe bin/pmhq/pmhq.exe
mv pmhq.dll bin/pmhq/
wget https://github.com/LLOneBot/LLBot.CLI/releases/latest/download/llbot-win-x64.exe
mv llbot-win-x64.exe llbot.exe
wget https://github.com/LLOneBot/exe/releases/latest/download/node.exe -O bin/llbot/node.exe
wget https://github.com/LLOneBot/exe/releases/latest/download/ffmpeg.exe -O bin/llbot/ffmpeg.exe
wget https://github.com/LLOneBot/exe/releases/latest/download/ffprobe.exe -O bin/llbot/ffprobe.exe
zip -r ../LLBot-CLI-win-x64.zip ./*
- name: Compress for Windows Desktop
run: |
mkdir llbot-desktop-win-x64
mkdir -p bin/llbot
cd llbot-desktop-win-x64
cp ../dist/使用说明.txt ./
cp ../dist/更新日志.txt ./
mkdir -p ./bin/llbot
cp -r ../dist/* ./bin/llbot/
wget https://github.com/LLOneBot/Lucky-Lillia-Desktop/releases/latest/download/lucky-lillia-desktop-win-x64.zip
unzip lucky-lillia-desktop-win-x64.zip
rm lucky-lillia-desktop-win-x64.zip
mv lucky-lillia-desktop.exe llbot.exe
zip -r ../LLBot-Desktop-win-x64.zip ./*
- name: Compress for Linux CLI x64
run: |
mkdir llbot-cli-linux-x64
cd llbot-cli-linux-x64
cp ../dist/使用说明.txt ./
cp ../dist/更新日志.txt ./
cp -r ../dist ./llbot
wget https://github.com/linyuchen/PMHQ/releases/latest/download/pmhq-linux-x64.zip
unzip pmhq-linux-x64.zip
rm pmhq-linux-x64.zip
mv pmhq-linux-x64 llbot/pmhq
wget https://github.com/LLOneBot/exe/releases/latest/download/node-linux-x64 -O llbot/node
cp ../script/start-linux.sh ./start.sh
zip -r ../LLBot-CLI-linux-x64.zip ./*
- name: Compress for Linux CLI arm64
run: |
mkdir llbot-cli-linux-arm64
cd llbot-cli-linux-arm64
cp ../dist/使用说明.txt ./
cp ../dist/更新日志.txt ./
cp -r ../dist ./llbot
wget https://github.com/linyuchen/PMHQ/releases/latest/download/pmhq-linux-arm64.zip
unzip pmhq-linux-arm64.zip
rm pmhq-linux-arm64.zip
mv pmhq-linux-arm64 llbot/pmhq
wget https://github.com/LLOneBot/exe/releases/latest/download/node-linux-arm64 -O llbot/node
cp ../script/start-linux.sh ./start.sh
zip -r ../LLBot-CLI-linux-arm64.zip ./*
- name: Compress for Docker
run: |
cp script/install-llbot-docker.sh LLBot-Docker.sh
# 手动触发时只上传 artifacts
- name: Upload LLBot.zip
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: LLBot
path: LLBot.zip
retention-days: 30
- name: Upload LLBot-Desktop-win-x64.zip
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: LLBot-Desktop-win-x64
path: LLBot-Desktop-win-x64.zip
retention-days: 30
- name: Upload LLBot-CLI-linux-x64.zip
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: LLBot-CLI-linux-x64
path: LLBot-CLI-linux-x64.zip
retention-days: 30
- name: Upload LLBot-CLI-linux-arm64.zip
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: LLBot-CLI-linux-arm64
path: LLBot-CLI-linux-arm64.zip
retention-days: 30
- name: Upload LLBot-Docker.sh
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: LLBot-Docker
path: LLBot-Docker.sh
retention-days: 30
# tag 触发时创建 release
- name: Extract version from tag
if: startsWith(github.ref, 'refs/tags/')
id: get-version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
- name: Generate release body from changelog
if: startsWith(github.ref, 'refs/tags/')
id: changelog
run: |
# 取第一个分段
content="$(awk 'BEGIN{RS="=================";ORS=""} NR==1{print}' doc/更新日志.txt)"
# 去掉前两行
body="$(echo "$content" | tail -n +3)"
# 去除前后空白
body="$(echo "$body" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
# 输出到 GITHUB_OUTPUT
echo "BODY<<EOF" >> $GITHUB_OUTPUT
echo "$body" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
artifacts: 'LLBot.zip, LLBot-Desktop-win-x64.zip, LLBot-CLI-win-x64.zip, LLBot-CLI-linux-x64.zip, LLBot-CLI-linux-arm64.zip, LLBot-Docker.sh'
draft: true
token: ${{ secrets.RELEASE_TOKEN }}
name: LuckyLilliaBot v${{ steps.get-version.outputs.VERSION }}
body: |
${{ steps.changelog.outputs.BODY }}
**Windows Desktop 版本只支持 Windows Server 2016 / Windows 10 及以上版本**
**Windows CLI 版本只支持 Windows server 2012 R2 / Windows 8.1 及以上版本**
- name: Publish to npm
if: startsWith(github.ref, 'refs/tags/')
run: |
npm install -g npm@latest
mv dist package
tar -czf llonebot-dist.tgz package/*
npm publish llonebot-dist.tgz --provenance