Skip to content

Commit

Permalink
增加版本号同步脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxinpro committed Jan 29, 2024
1 parent feaa02b commit 09d7334
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package main

import (
"crypto/md5"
Expand All @@ -11,7 +11,7 @@ import (
)

var (
VERSION = "1.5.54"
VERSION = "1.5.55"
)

var (
Expand Down
5 changes: 5 additions & 0 deletions version.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off
for /f "delims=" %%i in ('type .version') do set v=%%i
echo version=%v%
cscript //nologo "version.vbs" ".\src\main.go" "%v%"
exit /b 0
23 changes: 23 additions & 0 deletions version.vbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Dim objFSO, objFile, strContent, objRegEx, args, adodbStream

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set args = WScript.Arguments
Set adodbStream = CreateObject("ADODB.Stream")

adodbStream.Charset = "utf-8"
adodbStream.Open
adodbStream.LoadFromFile args(0)
strContent = adodbStream.ReadText
adodbStream.Close

Set objRegEx = New RegExp
objRegEx.Global = True
objRegEx.IgnoreCase = True
objRegEx.Pattern = "VERSION\s+=\s+\""[\d\.]+\"""
strContent = objRegEx.Replace(strContent, "VERSION = """ & args(1) & """")

adodbStream.Charset = "utf-8"
adodbStream.Open
adodbStream.WriteText strContent
adodbStream.SaveToFile args(0), 2
adodbStream.Close

0 comments on commit 09d7334

Please sign in to comment.