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