mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix:workflow
This commit is contained in:
9
.github/workflows/release.yml
vendored
9
.github/workflows/release.yml
vendored
@@ -1,18 +1,24 @@
|
|||||||
name: "release"
|
name: "release"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
|
|
||||||
|
permissions: write-all
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-version:
|
check-version:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Clone Repository
|
- name: Clone Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Extract version from tag
|
- name: Extract version from tag
|
||||||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Use Node.js 20.X
|
- name: Use Node.js 20.X
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
@@ -21,7 +27,8 @@ jobs:
|
|||||||
- name: Check Version
|
- name: Check Version
|
||||||
run: |
|
run: |
|
||||||
ls
|
ls
|
||||||
node ./checkVersion.js
|
node ./script/checkVersion.js
|
||||||
|
sh ./checkVersion.sh
|
||||||
build-linux:
|
build-linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
@@ -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")
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user