mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 04:45:46 +00:00
132 lines
3.6 KiB
YAML
132 lines
3.6 KiB
YAML
name: "release"
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
permissions: write-all
|
|
|
|
jobs:
|
|
check-version:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Clone
|
|
run: |
|
|
GITHUB_URL=https://oauth:${{ secrets.NAPCAT_BUILD }}@github.com//NapNeko/NapCatQQ
|
|
git clone --recurse-submodules ${GITHUB_URL} NapCatQQ
|
|
git config --global init.defaultBranch main
|
|
git config --global user.name "CheckVersion"
|
|
git config --global user.email "bot@noreply.github.com"
|
|
|
|
|
|
- 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: Clone Check Version
|
|
run: |
|
|
cd ./NapCatQQ
|
|
node ./script/checkVersion.cjs
|
|
sh ./checkVersion.cjs
|
|
cd ..
|
|
|
|
|
|
build-linux:
|
|
needs: [check-version]
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target_platform: [linux,darwin]
|
|
target_arch: [x64, arm64]
|
|
steps:
|
|
- name: Clone Main Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: 'NapNeko/NapCatQQ'
|
|
submodules: true
|
|
token: ${{ secrets.NAPCAT_BUILD }}
|
|
- name: Use Node.js 20.X
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20.x
|
|
|
|
- name: Build NuCat Linux
|
|
run: |
|
|
npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
|
|
npm run build:prod
|
|
cd dist
|
|
npm i --omit=dev --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
|
|
cd ..
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: NapCat.${{ matrix.target_platform }}.${{ matrix.target_arch }}
|
|
path: dist
|
|
build-win32:
|
|
runs-on: ubuntu-latest
|
|
needs: [check-version]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target_platform: [win32]
|
|
target_arch: [x64]
|
|
steps:
|
|
- name: Clone Main Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: 'NapNeko/NapCatQQ'
|
|
submodules: true
|
|
token: ${{ secrets.NAPCAT_BUILD }}
|
|
|
|
- name: Use Node.js 20.X
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20.x
|
|
|
|
- name: Build NuCat Linux
|
|
run: |
|
|
npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
|
|
npm run build:prod
|
|
cd dist
|
|
npm i --omit=dev --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
|
|
cd ..
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: NapCat.${{ matrix.target_platform }}.${{ matrix.target_arch }}
|
|
path: dist
|
|
|
|
release-napcat:
|
|
needs: [build-win32,build-linux]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download All Artifact
|
|
uses: actions/download-artifact@v4
|
|
|
|
- name: Compress subdirectories
|
|
run: |
|
|
for dir in */; do
|
|
base=$(basename "$dir")
|
|
zip -r "${base}.zip" "$dir"
|
|
done
|
|
|
|
- name: Create Release Draft and Upload Artifacts
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
name: NapCat V0.0.0
|
|
token: ${{ secrets.NAPCAT_BUILD }}
|
|
files: |
|
|
NapCat.win32.x64.zip
|
|
NapCat.linux.x64.zip
|
|
NapCat.linux.arm64.zip
|
|
NapCat.darwin.x64.zip
|
|
NapCat.darwin.arm64.zip
|
|
draft: true
|