From 1cb21999c0b461b8b78d45b70255b2a73bea52ec Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 25 Aug 2023 20:40:23 +0300 Subject: [PATCH] fix: clean up shellcheck warnings in act runner script --- act/run-act.sh | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/act/run-act.sh b/act/run-act.sh index 8060d8622..39edb76bb 100755 --- a/act/run-act.sh +++ b/act/run-act.sh @@ -1,26 +1,29 @@ -#!/bin/bash +#!/usr/bin/env bash +set -eo pipefail type=$1 # bump=$2 oldartifactsdir="old" -parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -cd "$parent_path" - -artifactfolders=$(find artifacts/ -maxdepth 1 -mindepth 1 -type d) -if [[ ${#artifactfolders[@]} > 0 ]]; then - for i in ${artifactfolders[@]}; do - foldername=$(dirname $i) - subfoldername=$(basename $i) - out=$foldername/$oldartifactsdir/$subfoldername-$(date +'%s') - if [[ ! "$subfoldername" =~ "$oldartifactsdir" ]]; then - mkdir -p $out - mv $i $out - printf "Moved "${foldername}"/"${subfoldername}" to "${out}" \n" - fi - done -fi +parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P ) +cd "$parent_path" || exit + +for i in artifacts/*; do + if [[ ! -d "$i" ]]; then + continue; + fi + subfoldername=$(basename "$i") + + if [[ "$subfoldername" == "$oldartifactsdir" ]]; then + continue; + fi + + out=artifacts/$oldartifactsdir/$subfoldername-$(date +'%s') + mkdir -p "$out" + mv "$i" "$out" + echo "Moved artifacts/${subfoldername} to ${out}" +done cd .. @@ -35,10 +38,10 @@ else printf "Options: 'release' or 'prerelease'\n" fi -cd act/artifacts +cd act/artifacts || exit if [[ -d "1" ]]; then - cd "1/artifact" + cd "1/artifact" || exit cp "PluginLoader.gz__" "PluginLoader.gz" gzip -d "PluginLoader.gz" chmod +x PluginLoader