From f37bbf93cb575003b50a460b2e642ece90b85eda 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 13:37:42 +0800 Subject: [PATCH] fix --- .github/workflows/release.yml | 23 +++++++++++++++-------- script/checkVersion.cjs | 3 ++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae5a5978..78ae6241 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,10 +11,14 @@ jobs: check-version: runs-on: ubuntu-latest steps: - - name: Clone Repository - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} + - 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 @@ -24,11 +28,14 @@ jobs: with: node-version: 20.x - - name: Check Version + - name: Clone Check Version run: | - ls - node ./script/checkVersion.cjs - sh ./checkVersion.sh + cd ./NapCatQQ + node ./script/checkVersion.cjs + sh ./checkVersion.cjs + cd .. + + build-linux: needs: [check-version] runs-on: ubuntu-latest diff --git a/script/checkVersion.cjs b/script/checkVersion.cjs index 2ebfe690..9ecbaf82 100644 --- a/script/checkVersion.cjs +++ b/script/checkVersion.cjs @@ -1,6 +1,7 @@ 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); @@ -11,5 +12,5 @@ if (currentVersion === targetVersion) { let packageJson = JSON.parse(fs.readFileSync("./package.json")); packageJson.version = targetVersion; fs.writeFileSync("./package.json", JSON.stringify(packageJson)); - fs.writeFileSync("./checkVersion.sh", "#!/bin/bashe\ngit config --global user.email \"bot@test.mail\"\n git config --global user.name \"Version\"\ngit checkout main\ngit add .\n git commit -m \"chore:version change\"\n git push -u origin main") + fs.writeFileSync("./checkVersion.sh", "#!/bin/bashe\ngit add .\n git commit -m \"chore:version change\"\n git push -u origin main") }