@@ -53,9 +53,13 @@ CONFIG_SUPPORTED_VALUES=( "DISABLE" "SKIP_PUBLISH" "SCHEMA_ENABLE" "SCHEMA_VALUE
5353# # can create new releases and commits
5454# # to the repository. The default configuration
5555# # environment variable 'CR_TOKEN' is prefered over
56- # # the input setting.
56+ # # the input setting. If nothing is set the GITHUB_TOKEN will
57+ # # be used. If none of these is set, the script will fail
5758# #
58- export CR_TOKEN=" ${CR_TOKEN:- $INPUT_TOKEN } " ;
59+ if [ -z " ${CR_TOKEN} " ]; then
60+ export CR_TOKEN=" ${INPUT_TOKEN:- $GITHUB_TOKEN } " ;
61+ fi
62+ if [ -z " ${CR_TOKEN} " ]; then echo -e " ${RED} Github Token required for release action${NONE} " && exit 1; fi
5963
6064# # Chart Releaser default repository URL.
6165# # This URL is used to fetch the current
@@ -288,19 +292,15 @@ if [[ ${#PUBLISH_CHARTS[@]} -gt 0 ]]; then
288292 fi
289293
290294 log " Creating Helm Package"
291- if [ -z " $DRY_RUN " ]; then
292- if [ " ${SKIP_PUBLISH,,} " == " true" ]; then
293- log " Skipping Publish"
295+ if [ " ${SKIP_PUBLISH,,} " == " true" ]; then
296+ log " Skipping Publish"
297+ else
298+ if helm package $CHART --dependency-update --destination ${CR_RELEASE_LOCATION} ; then
299+ log " Generated Package!" " ${GREEN} "
294300 else
295- if helm package $CHART --dependency-update --destination ${CR_RELEASE_LOCATION} ; then
296- log " Generated Package!" " ${GREEN} "
297- else
298- log " Generating Package failed!" " ${RED} "
299- CHARTS_ERR+=(" ${CHART} " );
300- fi
301+ log " Generating Package failed!" " ${RED} "
302+ CHARTS_ERR+=(" ${CHART} " );
301303 fi
302- else
303- log " Dry Run..."
304304 fi
305305 fi
306306
@@ -330,7 +330,10 @@ if [[ ${#PUBLISH_CHARTS[@]} -gt 0 ]]; then
330330 # # create a helm release on the GitHub Repository
331331 # #
332332 echo -e " \n${BLUE} - Creating Releases -${NONE} \n"
333- if [ -z " $DRY_RUN " ]; then
333+ if [[ " ${DRY_RUN,,} " == " true" ]]; then
334+ log " Dry Run..."
335+ exit 0;
336+ else
334337 if [ " $( ls -A ${CR_RELEASE_LOCATION} ) " ]; then
335338 if ! cr upload $CR_ARGS ; then echo -e " ${RED} Something went wrong! Checks the logs above${NONE} " ; exit 1; fi
336339
@@ -356,9 +359,6 @@ if [[ ${#PUBLISH_CHARTS[@]} -gt 0 ]]; then
356359 else
357360 log " Nothing to release" && exit 0
358361 fi
359- else
360- log " Dry Run..."
361- exit 0;
362362 fi
363363 else
364364 # # Some Feedback
0 commit comments