This commit is contained in:
手瓜一十雪
2024-04-16 13:42:22 +08:00
parent b670c546b9
commit 4044750515
2 changed files with 10 additions and 17 deletions

View File

@@ -11,14 +11,11 @@ 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: Clone Repository
uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
@@ -28,14 +25,11 @@ jobs:
with:
node-version: 20.x
- name: Clone Check Version
- name: Check Version
run: |
cd ./NapCatQQ
ls
node ./script/checkVersion.cjs
sh ./checkVersion.cjs
cd ..
sh ./checkVersion.sh
build-linux:
needs: [check-version]
runs-on: ubuntu-latest

View File

@@ -1,7 +1,6 @@
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);
@@ -12,5 +11,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 add .\n git commit -m \"chore:version change\"\n git push -u origin main")
fs.writeFileSync("./checkVersion.sh", "#!/bin/bashe\ngit config --global user.email \"bot@test.mail\"\n git config --global user.name \"Version\"\ngit add .\n git commit -m \"chore:version change\"\n git push -u origin main")
}