@@ -80,7 +80,7 @@ configure_gha() {
8080
8181 echo " 🔑 Adding GitHub Actions secrets..."
8282 # Loop through all files in the CI folder (sorted alphabetically)
83- find " $SPIN_CI_FOLDER " -type f -maxdepth 1 | sort | while read -r filepath; do
83+ find " $SPIN_CI_FOLDER " -maxdepth 1 -type f | sort | while read -r filepath; do
8484 file=$( basename " $filepath " )
8585 # Skip files with file extensions and .gitignore
8686 if [[ " $file " != * .* ]]; then
@@ -136,20 +136,31 @@ gh_set_env() {
136136 return 1
137137 fi
138138
139- # Get content from either file or value
140- local content
139+ # Get content from either file or value
141140 if [ -n " $file " ]; then
141+ if [ ! -f " $file " ]; then
142+ echo " ${BOLD}${RED} ❌ File not found: $file ${RESET} "
143+ return 1
144+ fi
145+
146+ # Read file content and normalize line endings to ensure consistency across platforms
147+ # Convert all line endings to Unix format (LF) for cross-platform compatibility
148+ content=$( cat " $file " | tr -d ' \r' )
149+
150+ # Optionally base64 encode the content
142151 if [ " $base64_encode " = true ]; then
143- content=$( base64_encode " $file " )
144- else
145- content=$( < " $file " )
152+ content=$( base64_encode " $content " )
146153 fi
147- else
154+ elif [ -n " $value " ]; then
155+ content=" $value "
156+
157+ # Optionally base64 encode the content
148158 if [ " $base64_encode " = true ]; then
149- content=$( echo -n " $value " | base64_encode -)
150- else
151- content=" $value "
159+ content=$( base64_encode " $content " )
152160 fi
161+ else
162+ echo " ${BOLD}${RED} ❌ No file or value specified${RESET} "
163+ return 1
153164 fi
154165
155166 # Set the secret using the gh CLI
0 commit comments