From 8a150b4cabf1dd2dae63213cab0036c4ab91c48b Mon Sep 17 00:00:00 2001
From: Cyrix126 <58007246+Cyrix126@users.noreply.github.com>
Date: Wed, 3 Apr 2024 11:41:53 +0200
Subject: [PATCH] feat: better automatization utils for releases

---
 TODO_XMRvsBeast.md          |  5 ++---
 utils/README.md             |  4 +++-
 utils/move_binary_inside.sh | 20 ++++++++++++++++++++
 utils/package.sh            |  2 +-
 4 files changed, 26 insertions(+), 5 deletions(-)
 create mode 100755 utils/move_binary_inside.sh

diff --git a/TODO_XMRvsBeast.md b/TODO_XMRvsBeast.md
index e3c8ebf..fc58fe5 100644
--- a/TODO_XMRvsBeast.md
+++ b/TODO_XMRvsBeast.md
@@ -61,17 +61,16 @@
   - [x] rename reference of gupax name to gupaxx
   - [ ] replace AppImage with a desktop file
 - [x] fix clippy
-- [ ] optimizations
+- [x] optimizations
   - [x] benchmarks table render only what is visible
   - [x] console output render only what is visible
-  - [ ] use tor socks proxy instead of creating one
     - [x] remove arti
-    - [ ] bundle arti cmd binary
     - [x] replace hyper with reqwest
 - [x] better organize new code
 - [x] merge commits from upstream
 - [x] tests for new function 
   - [x] time calculated by algorithm 
+- [x] better automatization with utils for releases
 - [x] pre-release
   - [ ] feedback
 - [ ] release
diff --git a/utils/README.md b/utils/README.md
index b77d742..b53411d 100644
--- a/utils/README.md
+++ b/utils/README.md
@@ -2,6 +2,8 @@
 
 | File/Folder | Purpose |
 |-------------|---------|
-| package.sh  | Package the contents of `skel`, sign, etc. Checks if all files exist and have the proper naming schemes
 | prepare.sh  | Changes version across repo, commits README.md + CHANGELOG.md
+| create_tmp_env.sh | create temporary directory to be used for packaging.
+| move_binary_inside.sh | once github CI finished, download zip inside temporary file and execute this script.
+| package.sh  | Package the contents of `skel`, sign, etc. Checks if all files exist and have the proper naming schemes
 | skel        | A skeleton directory with the proper naming scheme + folder structure for packaging Gupax for all OS's
diff --git a/utils/move_binary_inside.sh b/utils/move_binary_inside.sh
new file mode 100755
index 0000000..dd6babc
--- /dev/null
+++ b/utils/move_binary_inside.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+## to be executed once you get zip files containing binairies from github CI and put them in /tmp/gupaxx_*
+
+[[ -d skel ]]; check "skel"
+[[ -f linux.zip ]]; check "linux zip"
+[[ -f windows.zip ]]; check "windows zip"
+[[ -f macos.zip ]]; check "macos zip"
+unzip linux.zip; unzip macos.zip; unzip windows.zip
+mv gupaxx.exe skel/windows/Gupaxx.exe
+tar -xf linux.tar
+mv gupaxx skel/linux/gupaxx
+tar -xf macos.tar
+mv Gupaxx-macos-x64.app/Contents/Info.plist skel/macos-x64/Gupaxx.app/Contents/Info.plist
+mv Gupaxx-macos-x64.app/Contents/MacOS/gupaxx skel/macos-x64/Gupaxx.app/Contents/MacOS/gupaxx
+mv Gupaxx-macos-arm64.app/Contents/MacOS/gupaxx skel/macos-arm64/Gupaxx.app/Contents/MacOS/gupaxx
+mv Gupaxx-macos-arm64.app/Contents/Info.plist skel/macos-arm64/Gupaxx.app/Contents/Info.plist
+rm linux.zip; rm macos.zip; rm windows.zip
+# windows unzip only the exe so not tar to delete.
+rm linux.tar; rm macos.tar
diff --git a/utils/package.sh b/utils/package.sh
index fcdd4d7..1e47435 100755
--- a/utils/package.sh
+++ b/utils/package.sh
@@ -120,7 +120,7 @@ clipboard() {
 	echo '```'
 }
 CHANGELOG=$(clipboard); check "Create changelog + sign"
-echo "$CHANGELOG" | xclip -selection clipboard
+echo "$CHANGELOG" | wl-copy  $clipboard
 check "Changelog into clipboard"
 
 # Reset timezone