NapCatQQ/.github/workflows/release.yml

140 lines
4.0 KiB
YAML
Raw Normal View History

2024-06-26 09:16:54 +00:00
name: "Build 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:
2024-05-03 13:22:16 +00:00
target_platform: [linux]
2024-04-14 16:22:46 +00:00
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-05-09 10:46:32 +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: |
2024-05-03 13:22:16 +00:00
export NAPCAT_BUILDSYS=${{ matrix.target_platform }}
export NAPCAT_BUILDARCH=${{ matrix.target_arch }}
2024-04-14 16:22:46 +00:00
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]
2024-06-17 02:03:59 +00:00
target_arch: [x64,ia32]
2024-04-14 16:22:46 +00:00
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-05-09 10:46:32 +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: |
2024-05-03 13:22:16 +00:00
export NAPCAT_BUILDSYS=${{ matrix.target_platform }}
export NAPCAT_BUILDARCH=${{ matrix.target_arch }}
2024-04-14 16:22:46 +00:00
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-05-03 12:34:32 +00:00
2024-05-03 12:44:04 +00:00
- name: Clone Changes Log
2024-05-18 10:18:08 +00:00
run: curl -o CHANGELOG.md https://fastly.jsdelivr.net/gh/NapNeko/NapCatQQ@main/docs/changelogs/CHANGELOG.v${{ env.VERSION }}.md
2024-05-03 12:34:32 +00:00
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-06-26 10:13:55 +00:00
NapCat.win32.ia32.zip
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