Skip to content

Commit

Permalink
feat: add auto version parse
Browse files Browse the repository at this point in the history
  • Loading branch information
OEOTYAN committed Mar 30, 2024
1 parent 1f36a72 commit e4f4986
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "${pluginName}",
"entry": "${pluginFile}",
"version": "${pluginVersion}",
"type": "native"
}
7 changes: 7 additions & 0 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,16 @@ target("my-plugin") -- Change this to your plugin name.
after_build(function (target)
local plugin_packer = import("scripts.after_build")

local tag = os.iorun("git describe --tags --abbrev=0 --always")
local major, minor, patch, suffix = tag:match("v(%d+)%.(%d+)%.(%d+)(.*)")
if not major then
print("Failed to parse version tag, using 0.0.0")
major, minor, patch = 0, 0, 0
end
local plugin_define = {
pluginName = target:name(),
pluginFile = path.filename(target:targetfile()),
pluginVersion = major .. "." .. minor .. "." .. patch,
}

plugin_packer.pack_plugin(target,plugin_define)
Expand Down

0 comments on commit e4f4986

Please sign in to comment.