From 52076fe1822185e0952f4fdcf82471879f446eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 16 Apr 2024 08:50:48 +0800 Subject: [PATCH 01/12] chore: version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cdc6e7e0..2cf6ccf9 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "napcat", "private": true, "type": "module", - "version": "1.0.2", + "version": "1.0.3", "scripts": { "watch:dev": "vite --mode development", "watch:prod": "vite --mode production", From dfbad854657f0107556ba285200b4c0e73c777ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 16 Apr 2024 10:02:40 +0800 Subject: [PATCH 02/12] re:version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2cf6ccf9..cdc6e7e0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "napcat", "private": true, "type": "module", - "version": "1.0.3", + "version": "1.0.2", "scripts": { "watch:dev": "vite --mode development", "watch:prod": "vite --mode production", From aded70eb2eb5fdba5dfc915226567eede753cb87 Mon Sep 17 00:00:00 2001 From: linyuchen Date: Tue, 16 Apr 2024 10:27:32 +0800 Subject: [PATCH 03/12] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..8a2e9ba7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 NapCatQQ + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 9db28bd5021459621d9982c04e267d79be841d57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 16 Apr 2024 11:43:14 +0800 Subject: [PATCH 04/12] fix:version output --- src/onebot11/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/onebot11/index.ts b/src/onebot11/index.ts index 36b8b847..adb48ade 100644 --- a/src/onebot11/index.ts +++ b/src/onebot11/index.ts @@ -21,15 +21,16 @@ checkVersion().then((remoteVersion: string) => { const localVersion = require('./package.json').version; const localVersionList = localVersion.split('.'); const remoteVersionList = remoteVersion.split('.'); + console.log('[NapCat] [Upate] 当前版本:', localVersion); for (const k of [0, 1, 2]) { if (parseInt(remoteVersionList[k]) > parseInt(localVersionList[k])) { - console.log('检测到更新,请前往 https://github.com/NapNeko/NapCatQQ 下载 NapCatQQ V', remoteVersion); + console.log('[NapCat] [Upate] 检测到更新,请前往 https://github.com/NapNeko/NapCatQQ 下载 NapCatQQ V', remoteVersion); return; } else if (parseInt(remoteVersionList[k]) < parseInt(localVersionList[k])) { break; } } - console.log('当前已是最新版本,版本:', localVersion); + console.log('[NapCat] [Upate] 当前已是最新版本'); return; }); new NapCatOnebot11(); From ed56e177cf27847df41e049f788f7a73f475e3e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 16 Apr 2024 11:49:44 +0800 Subject: [PATCH 05/12] chore:workflow version --- .github/workflows/release.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3feeb1df..0f16284b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,14 @@ jobs: - name: Use Node.js 20.X uses: actions/setup-node@v4 with: - node-version: 20.x + node-version: 20.x + + - name: Extract version from tag + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + + - name: Print version + run: echo $VERSION + - name: Build NuCat Linux run: | npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }} @@ -53,6 +60,12 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20.x + - name: Extract version from tag + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + + - name: Print version + run: echo $VERSION + - name: Build NuCat Linux run: | npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }} From 9d7729f548578a03770a2dc382bd5df01fc0f58e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 16 Apr 2024 12:21:50 +0800 Subject: [PATCH 06/12] fix:workflow --- .github/workflows/release.yml | 32 +++++++++++++++++++++----------- script/checkVersion.js | 0 2 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 script/checkVersion.js diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0f16284b..1cc2e7a4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,23 @@ on: - "v*" jobs: + check-version: + runs-on: ubuntu-latest + steps: + - name: Clone Repository + uses: actions/checkout@v4 + + - 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 ./checkVersion.js build-linux: runs-on: ubuntu-latest strategy: @@ -24,12 +41,6 @@ jobs: with: node-version: 20.x - - name: Extract version from tag - run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV - - - name: Print version - run: echo $VERSION - - name: Build NuCat Linux run: | npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }} @@ -56,15 +67,11 @@ jobs: 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: Extract version from tag - run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV - - - name: Print version - run: echo $VERSION - name: Build NuCat Linux run: | @@ -73,11 +80,13 @@ jobs: 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 @@ -91,6 +100,7 @@ jobs: base=$(basename "$dir") zip -r "${base}.zip" "$dir" done + - name: Create Release Draft and Upload Artifacts uses: softprops/action-gh-release@v1 with: diff --git a/script/checkVersion.js b/script/checkVersion.js new file mode 100644 index 00000000..e69de29b From a362f920dc4da60149f0ba8f66cc310ea1a3cc99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 16 Apr 2024 12:41:18 +0800 Subject: [PATCH 07/12] fix:workflow --- .github/workflows/release.yml | 9 ++++++++- script/checkVersion.js | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1cc2e7a4..69f0b833 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,18 +1,24 @@ name: "release" + on: push: tags: - "v*" +permissions: write-all + jobs: check-version: runs-on: ubuntu-latest steps: - name: Clone Repository uses: actions/checkout@v4 + with: + 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: @@ -21,7 +27,8 @@ jobs: - name: Check Version run: | ls - node ./checkVersion.js + node ./script/checkVersion.js + sh ./checkVersion.sh build-linux: runs-on: ubuntu-latest strategy: diff --git a/script/checkVersion.js b/script/checkVersion.js index e69de29b..35ee9c2a 100644 --- a/script/checkVersion.js +++ b/script/checkVersion.js @@ -0,0 +1,16 @@ +let fs = require("fs"); +let process = require("process") +console.log("[NapCat] [CheckVersion] 开始检测当前仓库版本..."); +let currentVersion = require("./package.json").version; +let targetVersion = process.env.VERSION; +console.log("[NapCat] [CheckVersion] currentVersion:", currentVersion, " targetVersion:", targetVersion); +// 借用dist目录输出脚本 +fs.mkdir("./dist"); +if (currentVersion === targetVersion) { + fs.appendFileSync("./checkVersion.sh", "#!/bin/bashe\necho \"CheckVersion Is Done\"") +} else { + let packageJson = JSON.parse(fs.readFileSync("./package.json")); + packageJson.version = targetVersion; + fs.writeFileSync(JSON.stringify(packageJson)); + fs.appendFileSync("./checkVersion.sh", "#!/bin/bashe\ngit add .\n git commit -m \"chore:version change\"\n git push") +} From 09120171ba0e44ef48bf74508c4bf39cdfa48de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 16 Apr 2024 12:42:07 +0800 Subject: [PATCH 08/12] fix --- script/checkVersion.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/checkVersion.js b/script/checkVersion.js index 35ee9c2a..8ab084d6 100644 --- a/script/checkVersion.js +++ b/script/checkVersion.js @@ -11,6 +11,6 @@ if (currentVersion === targetVersion) { } else { let packageJson = JSON.parse(fs.readFileSync("./package.json")); packageJson.version = targetVersion; - fs.writeFileSync(JSON.stringify(packageJson)); + fs.writeFileSync("./package.json", JSON.stringify(packageJson)); fs.appendFileSync("./checkVersion.sh", "#!/bin/bashe\ngit add .\n git commit -m \"chore:version change\"\n git push") } From fc91c6bc08c2a268c0d3aba7bd3bf18df0cd1238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 16 Apr 2024 12:43:39 +0800 Subject: [PATCH 09/12] fix --- script/{checkVersion.js => checkVersion.cjs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename script/{checkVersion.js => checkVersion.cjs} (100%) diff --git a/script/checkVersion.js b/script/checkVersion.cjs similarity index 100% rename from script/checkVersion.js rename to script/checkVersion.cjs From 84083a65a84bf0aac264f62c30dc0ceb996a0471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 16 Apr 2024 12:45:07 +0800 Subject: [PATCH 10/12] fix:checkVesion --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 69f0b833..6e2371dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: - name: Check Version run: | ls - node ./script/checkVersion.js + node ./script/checkVersion.cjs sh ./checkVersion.sh build-linux: runs-on: ubuntu-latest From fe0f82fa2b961adaa7e731b62b1ea78ce8be7da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 16 Apr 2024 12:46:37 +0800 Subject: [PATCH 11/12] fix:checkVesion --- .gitignore | 1 + script/checkVersion.cjs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 615fd51d..a23658d9 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ src/core.lib/common/ # Build *.db +checkVersion.sh \ No newline at end of file diff --git a/script/checkVersion.cjs b/script/checkVersion.cjs index 8ab084d6..4216f1b3 100644 --- a/script/checkVersion.cjs +++ b/script/checkVersion.cjs @@ -1,16 +1,16 @@ let fs = require("fs"); let process = require("process") console.log("[NapCat] [CheckVersion] 开始检测当前仓库版本..."); -let currentVersion = require("./package.json").version; +let currentVersion = require("../package.json").version; let targetVersion = process.env.VERSION; console.log("[NapCat] [CheckVersion] currentVersion:", currentVersion, " targetVersion:", targetVersion); // 借用dist目录输出脚本 fs.mkdir("./dist"); if (currentVersion === targetVersion) { - fs.appendFileSync("./checkVersion.sh", "#!/bin/bashe\necho \"CheckVersion Is Done\"") + fs.appendFileSync("../checkVersion.sh", "#!/bin/bashe\necho \"CheckVersion Is Done\"") } else { let packageJson = JSON.parse(fs.readFileSync("./package.json")); packageJson.version = targetVersion; - fs.writeFileSync("./package.json", JSON.stringify(packageJson)); - fs.appendFileSync("./checkVersion.sh", "#!/bin/bashe\ngit add .\n git commit -m \"chore:version change\"\n git push") + fs.writeFileSync("../package.json", JSON.stringify(packageJson)); + fs.appendFileSync("../checkVersion.sh", "#!/bin/bashe\ngit add .\n git commit -m \"chore:version change\"\n git push") } From 4d1d890f729e73e3140b6297e74bd32bd5df8c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 16 Apr 2024 12:47:36 +0800 Subject: [PATCH 12/12] fix --- script/checkVersion.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/checkVersion.cjs b/script/checkVersion.cjs index 4216f1b3..5cd8911b 100644 --- a/script/checkVersion.cjs +++ b/script/checkVersion.cjs @@ -5,7 +5,7 @@ let currentVersion = require("../package.json").version; let targetVersion = process.env.VERSION; console.log("[NapCat] [CheckVersion] currentVersion:", currentVersion, " targetVersion:", targetVersion); // 借用dist目录输出脚本 -fs.mkdir("./dist"); +fs.mkdirSync("./dist"); if (currentVersion === targetVersion) { fs.appendFileSync("../checkVersion.sh", "#!/bin/bashe\necho \"CheckVersion Is Done\"") } else {