NapCatQQ/.github/workflows/release.yml

132 lines
3.5 KiB
YAML
Raw Normal View History

2024-04-14 16:22:46 +00:00
name: "release"
2024-04-16 04:41:18 +00:00
2024-04-14 16:09:08 +00:00
on:
push:
tags:
- "v*"
2024-04-16 04:41:18 +00:00
permissions: write-all
2024-04-14 16:09:08 +00:00
jobs:
2024-04-16 04:21:50 +00:00
check-version:
runs-on: ubuntu-latest
steps:
2024-04-16 05:42:22 +00:00
- name: Clone Repository
uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
2024-04-16 04:21:50 +00:00
- name: Extract version from tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
2024-04-16 04:41:18 +00:00
2024-04-16 04:21:50 +00:00
- name: Use Node.js 20.X
uses: actions/setup-node@v4
with:
node-version: 20.x
2024-04-16 05:42:22 +00:00
- name: Check Version
2024-04-16 04:21:50 +00:00
run: |
2024-04-16 05:42:22 +00:00
ls
node ./script/checkVersion.cjs
sh ./checkVersion.sh
2024-04-14 16:22:46 +00:00
build-linux:
2024-04-16 04:55:16 +00:00
needs: [check-version]
2024-04-14 16:09:08 +00:00
runs-on: ubuntu-latest
2024-04-14 16:22:46 +00:00
strategy:
fail-fast: false
matrix:
target_platform: [linux,darwin]
target_arch: [x64, arm64]
2024-04-14 16:09:08 +00:00
steps:
2024-04-14 16:22:46 +00:00
- name: Clone Main Repository
uses: actions/checkout@v4
2024-04-14 16:09:08 +00:00
with:
2024-04-15 03:26:11 +00:00
repository: 'NapNeko/NapCatQQ'
2024-04-17 10:40:49 +00:00
submodules: true
2024-04-16 05:49:32 +00:00
ref: main
2024-04-17 10:40:49 +00:00
token: ${{ secrets.NAPCAT_BUILD }}
2024-04-14 16:22:46 +00:00
- name: Use Node.js 20.X
uses: actions/setup-node@v4
with:
2024-04-16 03:49:44 +00:00
node-version: 20.x
2024-04-14 16:22:46 +00:00
- 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
2024-04-16 04:55:16 +00:00
needs: [check-version]
2024-04-14 16:22:46 +00:00
strategy:
fail-fast: false
matrix:
target_platform: [win32]
target_arch: [x64]
steps:
- name: Clone Main Repository
uses: actions/checkout@v4
with:
2024-04-15 03:26:11 +00:00
repository: 'NapNeko/NapCatQQ'
2024-04-14 16:22:46 +00:00
submodules: true
2024-04-16 05:49:32 +00:00
ref: main
2024-04-17 10:40:49 +00:00
token: ${{ secrets.NAPCAT_BUILD }}
2024-04-16 04:21:50 +00:00
2024-04-14 16:22:46 +00:00
- name: Use Node.js 20.X
uses: actions/setup-node@v4
with:
node-version: 20.x
2024-04-16 03:49:44 +00:00
2024-04-14 16:22:46 +00:00
- 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 ..
2024-04-16 04:21:50 +00:00
2024-04-14 16:22:46 +00:00
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: NapCat.${{ matrix.target_platform }}.${{ matrix.target_arch }}
path: dist
2024-04-16 04:21:50 +00:00
2024-04-14 16:52:59 +00:00
release-napcat:
2024-04-14 16:54:02 +00:00
needs: [build-win32,build-linux]
2024-04-14 16:52:59 +00:00
runs-on: ubuntu-latest
steps:
2024-04-14 17:01:36 +00:00
- name: Download All Artifact
uses: actions/download-artifact@v4
2024-04-14 17:11:29 +00:00
- name: Compress subdirectories
run: |
for dir in */; do
base=$(basename "$dir")
zip -r "${base}.zip" "$dir"
done
2024-04-16 05:53:14 +00:00
- name: Extract version from tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
2024-04-14 16:52:59 +00:00
- name: Create Release Draft and Upload Artifacts
uses: softprops/action-gh-release@v1
with:
2024-04-16 06:01:05 +00:00
name: NapCat V${{ env.VERSION }}
2024-04-17 10:27:08 +00:00
token: ${{ secrets.GITHUB_TOKEN }}
2024-04-26 10:46:12 +00:00
body_path: CHANGELOG.md
2024-04-14 16:52:59 +00:00
files: |
2024-04-14 17:17:24 +00:00
NapCat.win32.x64.zip
NapCat.linux.x64.zip
2024-04-14 16:52:59 +00:00
NapCat.linux.arm64.zip
2024-04-17 10:27:08 +00:00
# NapCat.darwin.x64.zip
# NapCat.darwin.arm64.zip
2024-04-14 16:52:59 +00:00
draft: true