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 USAGE: $::argv0 <tag> <ext_path> \[OPTIONS\] \n. Options:"
36 if {[
catch {
array set options [
cmdline::getoptions ::argv $parameters $usage]}] || [
llength $argv] < 2 } {
42 set tag [
lindex $argv 0]
43 set ext_path [
lindex $argv 1]
48 foreach proj $projects_list {
50 set proj_name [
file tail $proj]
51 set proj_dir [
file dirname $proj]
52 set dir $repo_path/Top/$proj
54 if {"$ver"=="0" || "$ver"=="$tag" || $options(force)==1} {
56 Msg Info "Retrieving $proj binaries and tag $tag..."
57 if {[
catch {glob -types d $repo_path/bin/$proj*} prj_dir]} {
58 Msg CriticalWarning "Cannot find $proj binaries in artifacts"
61 if { $proj_dir != "." } {
62 set proj_zip [
string map {/ _} $proj_dir]
63 set files [glob -nocomplain -directory "$repo_path/zipped/" ${proj_zip}_${proj_name}-${tag}.z*]
65 set files [glob -nocomplain -directory "$repo_path/zipped/" ${proj_name}-${tag}.z*]
68 set ext [
file extension $f]
69 Execute glab release upload $tag "$f#${proj}-${tag}$ext"
71 }
elseif {"$ver"=="-1"} {
73 Msg CriticalWarning "Something went wrong when tried to retrieve version for project $proj"
78 Msg Info "Retrieving existing link for $proj binaries and tag $ver"
79 lassign [
ExecuteRet glab release view $ver] ret msg
81 Msg Warning "Some problem when fetching release $ver : $msg"
84 foreach line [
split $msg "\n"] {
85 if {[
string first "${proj}-${ver}.z" $line] > -1} {
86 set name [
lindex [
split $line] 0]
87 set link [
lindex [
split $line] 1]
88 set json "\[{ \"name\": \"$name\",\"url\": \"$link\",\"link_type\": \"other\" } \]"
89 Execute glab release upload $tag --assets-links=$json