mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-05 18:49:06 +00:00
Automate updating the license's year for every released version
This commit is contained in:
parent
53a98637c0
commit
9b36969c8b
@ -41,6 +41,8 @@ def "main metadata" []: nothing -> nothing {
|
|||||||
update_mudblazor_version
|
update_mudblazor_version
|
||||||
update_tauri_version
|
update_tauri_version
|
||||||
update_project_commit_hash
|
update_project_commit_hash
|
||||||
|
update_license_year "../../LICENSE"
|
||||||
|
update_license_year "Components/Pages/About.razor.cs"
|
||||||
}
|
}
|
||||||
|
|
||||||
def "main fix_web_assets" []: nothing -> nothing {
|
def "main fix_web_assets" []: nothing -> nothing {
|
||||||
@ -247,6 +249,25 @@ def update_tauri_version []: nothing -> nothing {
|
|||||||
$meta_lines | save --raw --force ../../metadata.txt
|
$meta_lines | save --raw --force ../../metadata.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def update_license_year [licence_file: string] {
|
||||||
|
let current_year = (date now | date to-timezone UTC | format date "%Y")
|
||||||
|
let license_text = open --raw $licence_file | lines
|
||||||
|
print $"Updating the license's year in ($licence_file) to ($current_year)."
|
||||||
|
|
||||||
|
# Target line looks like `Copyright 2024 Thorsten Sommer`.
|
||||||
|
# Perhaps, there are whitespaces at the beginning. Using
|
||||||
|
# a regex to match the year.
|
||||||
|
let updated_license_text = $license_text | each { |it|
|
||||||
|
if $it =~ '^\s*Copyright\s+[0-9]{4}' {
|
||||||
|
$it | str replace --regex '([0-9]{4})' $"($current_year)"
|
||||||
|
} else {
|
||||||
|
$it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$updated_license_text | save --raw --force $licence_file
|
||||||
|
}
|
||||||
|
|
||||||
def update_app_version [action: string]: string -> bool {
|
def update_app_version [action: string]: string -> bool {
|
||||||
mut meta_lines = open --raw ../../metadata.txt | lines
|
mut meta_lines = open --raw ../../metadata.txt | lines
|
||||||
mut app_version = $meta_lines.0
|
mut app_version = $meta_lines.0
|
||||||
|
Loading…
Reference in New Issue
Block a user