From a634470adde7f00fcf4d29b9f73ff9c4eb5a730b Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Wed, 23 Oct 2024 23:13:31 +0100 Subject: [PATCH] test: gha --- .github/workflows/baboon-build.yml | 14 ++------------ prepare-dist.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 12 deletions(-) create mode 100755 prepare-dist.sh diff --git a/.github/workflows/baboon-build.yml b/.github/workflows/baboon-build.yml index e086f45..aec045b 100644 --- a/.github/workflows/baboon-build.yml +++ b/.github/workflows/baboon-build.yml @@ -81,21 +81,11 @@ jobs: pattern: baboon-* - name: Prepare layout run: | - set -e - set -x - - tree ./binaries - - mkdir dist - mkdir dist-zip - - cd ./binaries - find . -name 'baboon-*' -type d -exec bash -e -x -c "zip -r9 ../dist-zip/{}.zip {}/baboon*" \; - find . -name 'baboon-*' -type d -exec bash -e -x -c "mv {} ../dist-zip/" \; + bash prepare-dist.sh ./binaries - uses: softprops/action-gh-release@v2 id: create-release if: startsWith(github.ref, 'refs/tags/') with: files: | - dist/** + dist-bin/** dist-zip/** diff --git a/prepare-dist.sh b/prepare-dist.sh new file mode 100755 index 0000000..0ca65f7 --- /dev/null +++ b/prepare-dist.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -x +set -e + + +src=$1 + +mkdir -p dist-bin +mkdir -p dist-zip + +distbin="$(pwd)/dist-bin" +distzip="$(pwd)/dist-zip" + +pushd . + +cd $src + +for d in baboon-* +do + if [[ -f ./$d/baboon ]]; then + cp ./${d}/baboon ${distbin}/${d} + zip -r9 -j ${distzip}/${d}.zip ${distbin}/${d} + elif [[ -f ./$d/baboon.exe ]]; then + cp ./${d}/baboon.exe ${distbin}/${d}.exe + zip -r9 -j ${distzip}/${d}.zip ${distbin}/${d}.exe + else + false + fi +done