From a8ed88770f3080e7a5cbafd36abe2136aaaba322 Mon Sep 17 00:00:00 2001 From: Moncef AOUDIA Date: Fri, 15 Dec 2023 22:42:07 +0100 Subject: [PATCH] refactor: ultimate fight --- .github/workflows/cd.yml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d9d3dfad3f..8bb5972a9b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -98,24 +98,26 @@ jobs: run: | source_directory="artifacts" tmp_directory="tmp" - release_directory="release" + release_directory="$(pwd)/release" mkdir -p "$tmp_directory" mkdir -p "$release_directory" for file in "$source_directory"/*.{zip,gz}; do - if [ -f "$file" ]; then - mv "$file" "$tmp_directory" - cd "$tmp_directory" || exit - if [[ "$file" == *.zip ]]; then - unzip -q "$(basename "$file")" -d "$release_directory" - rm "$(basename "$file")" - echo "Extracted $(basename "$file") to $release_directory" - elif [[ "$file" == *.gz ]]; then - gzip -d "$(basename "$file")" - echo "Extracted $(basename "$file") in $tmp_directory" - fi - fi + if [ -f "$file" ]; then + mv "$file" "$tmp_directory" + cd "$tmp_directory" || exit + if [[ "$file" == *.zip ]]; then + unzip -q "$(basename "$file")" -d "$release_directory" + rm "$(basename "$file")" + echo "Extracted $(basename "$file") to $release_directory" + elif [[ "$file" == *.gz ]]; then + tar -xzf "$(basename "$file")" -C "$release_directory" + rm "$(basename "$file")" + echo "Extracted $(basename "$file") to $release_directory" + fi + cd - || exit + fi done rm -rf "$tmp_directory"