From f65338b2270dcba14afacc72e1995d6e1533a0ca Mon Sep 17 00:00:00 2001 From: lutinglt Date: Tue, 24 Jun 2025 20:48:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9C=AC=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 5 +---- package.json | 3 ++- scripts/version.cjs | 8 ++++++++ 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 scripts/version.cjs diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ffd0e95..31cfb10 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,13 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: denoland/setup-deno@v2 - with: - deno-version: v2.x - name: Create release run: | export TZ=Asia/Shanghai - TAG="v$(deno run -q version).$(date +%y%m%d%H%M)" + TAG="v$(npm run -s version).$(date +%y%m%d%H%M)" gh release create "$TAG" dist/* --notes-file .github/release.md --draft -t $TAG env: GH_TOKEN: ${{ github.token }} diff --git a/package.json b/package.json index 0ee7cd6..5797c5d 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "build": "tsc -b && vite build", "lint": "eslint .", "format": "prettier --write .", - "commit": "npm run lint && npm run format && npm run build" + "commit": "npm run lint && npm run format && npm run build", + "version": "node scripts/version.cjs" }, "devDependencies": { "@babel/preset-react": "^7.27.1", diff --git a/scripts/version.cjs b/scripts/version.cjs new file mode 100644 index 0000000..6fce28e --- /dev/null +++ b/scripts/version.cjs @@ -0,0 +1,8 @@ +const fs = require('fs'); +const path = require('path'); + +const pkgPath = path.join(__dirname, '..', 'package.json'); +const pkg = JSON.parse(fs.readFileSync(pkgPath)); + +const version = pkg.version; +console.log(version); \ No newline at end of file