- 同时修改
package.json
tauri.conf.json
Cargo.toml
的版本号
#!/bin/bash
function update_package_version() {
local version=$1
local file_path='package.json'
local file_content=$(cat $file_path)
local new_file_content=$(echo "$file_content" | sed -E "s/\"version\": \"[0-9]+\.[0-9]+\.[0-9]+\"/\"version\": \"$version\"/")
echo "$new_file_content" > $file_path
}
function update_tauri_conf_version() {
local version=$1
local file_path='src-tauri/tauri.conf.json'
local file_content=$(cat $file_path)
local new_file_content=$(echo "$file_content" | sed -E "s/\"version\": \"[0-9]+\.[0-9]+\.[0-9]+\"/\"version\": \"$version\"/")
echo "$new_file_content" > $file_path
}
function update_cargo_version() {
local version=$1
local file_path='src-tauri/Cargo.toml'
local file_content=$(cat $file_path)
local new_file_content=$(echo "$file_content" | sed -E "s/version = \"[0-9]+\.[0-9]+\.[0-9]+\"/version = \"$version\"/")
echo "$new_file_content" > $file_path
}
update_package_version $1
update_tauri_conf_version $1
update_cargo_version $1