Skip to content

Commit

Permalink
fix(ci): Move env variables to script parameters
Browse files Browse the repository at this point in the history
In this way its easier to hand them over to the script from taskfile
  • Loading branch information
steinbrueckri committed Sep 21, 2024
1 parent 16ad766 commit b33e24d
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions get_gallery_images.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
#!/usr/bin/env bash
export PATH=$PATH:$HOME/bin
## Configuration #######################################################################################################
search_path="content/gallery/**"
## Configuration ###############################################################
SEARCH_PATH="content/gallery/**"
B2_APPLICATION_KEY_ID=$2
B2_APPLICATION_KEY=$3

## PreFlight checks ####################################################################################################
## PreFlight checks ###########################################################
# Check if b2 command is available
if ! command -v b2 &> /dev/null
then
echo "b2 could not be found"
exit
fi

# check ENVs
[ -z "$B2_APPLICATION_KEY_ID" ] && echo "ERROR: B2_APPLICATION_KEY_ID is not set!" && exit 255
[ -z "$B2_APPLICATION_KEY" ] && echo "ERROR: B2_APPLICATION_KEY is not set!" && exit 255

## Flight ##############################################################################################################
for index in $(find $search_path -name 'index.md'); do
## Flight ######################################################################
for index in $(find $SEARCH_PATH -name 'index.md'); do
# get basepath
basepath=$(dirname "$index")
target="$basepath/img/"
Expand All @@ -30,5 +28,5 @@ for index in $(find $search_path -name 'index.md'); do
echo "BasePath: $basepath"
echo "ImageFolder: $target"
echo "Source: $source"
b2 sync --delete --noProgress "$source" "$target"
done
b2 sync --delete --no-progress "$source" "$target"
done

0 comments on commit b33e24d

Please sign in to comment.