21 set TclPath [
file dirname [
info script]]/..
22 set repo_path [
file normalize "$TclPath/../.."]
23 source $TclPath/hog.tcl
25 if {[
catch {
package require cmdline} ERROR]} {
26 Msg Error "$ERROR\n If you are running this script on tclsh, you can fix this by installing 'tcllib'"
31 {force "Forces the creation of new project links"}
34 set usage "- CI script that retrieves binary files links or creates new ones to be uploaded to a GitLab release\n \
35 USAGE: $::argv0 <tag> <ext_path> \[OPTIONS\] \n. Options:"
37 if {[
catch {
array set options [
cmdline::getoptions ::argv $parameters $usage]}] || [
llength $argv] < 2} {
43 set tag [
lindex $argv 0]
44 set ext_path [
lindex $argv 1]
49 foreach proj $projects_list {
51 set proj_name [
file tail $proj]
52 set proj_dir [
file dirname $proj]
53 set dir $repo_path/Top/$proj
55 if {"$ver" == "0" || "$ver" == "$tag" || $options(force) == 1} {
57 Msg Info "Retrieving $proj binaries and tag $tag..."
58 if {[
catch {glob -types d $repo_path/bin/$proj*} prj_dir]} {
59 Msg CriticalWarning "Cannot find $proj binaries in artifacts"
62 if {$proj_dir != "."} {
63 set proj_zip [
string map {/ _} $proj_dir]
64 set files [glob -nocomplain -directory "$repo_path/zipped/" ${proj_zip}_${proj_name}-${tag}.z*]
66 set files [glob -nocomplain -directory "$repo_path/zipped/" ${proj_name}-${tag}.z*]
69 set ext [
file extension $f]
70 Execute glab release upload $tag "$f#${proj}-${tag}$ext"
72 }
elseif {"$ver" == "-1"} {
74 Msg CriticalWarning "Something went wrong when tried to retrieve version for project $proj"
79 Msg Info "Retrieving existing link for $proj binaries and tag $ver"
80 lassign [
ExecuteRet glab release view $ver] ret msg
82 Msg Warning "Some problem when fetching release $ver : $msg"
85 foreach line [
split $msg "\n"] {
86 if {[
string first "${proj}-${ver}.z" $line] == 0} {
87 set name [
lindex [
split $line] 0]
88 set link [
lindex [
split $line] 1]
89 set json "\[{ \"name\": \"$name\",\"url\": \"$link\",\"link_type\": \"other\" } \]"
90 Execute glab release upload $tag --assets-links=$json