Skip to content

Commit

Permalink
WIP: fakereleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
zwindler committed Aug 3, 2023
1 parent 35cd5cb commit b59f7ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ builds:
- CGO_ENABLE=1
goos:
- linux
#- windows
#- android
- windows
- android
goarch:
- amd64
# - arm64
- arm64
gobinary: ./fake-releaser.sh
ignore:
- goos: windows
Expand Down
34 changes: 14 additions & 20 deletions fake-releaser.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,43 @@
GOBIN=~/go/bin/
PATH=$PATH:$GOBIN

# Function to extract tar archive and move files to the destination directory
extract_and_move() {
local source_file="$1"
local target_dir="$2"

tar --strip-components=3 --wildcards -xJ '*/gocastle' -f "$source_file" -C "$target_dir"
}

build_linux_amd64() {
touch lock
touch buildlock
fyne-cross linux -arch=amd64,arm64 -app-id fr.zwindler.gocastle
extract_and_move fyne-cross/dist/linux-amd64/gocastle.tar.xz dist/gocastle_linux_amd64_v1/
echo `ls -al dist/gocastle_linux_amd64_v1/` > toto.log
sleep 1
rm lock
mkdir -p dist/gocastle_linux_amd64_v1/
cp fyne-cross/bin/linux-amd64/gocastle dist/gocastle_linux_amd64_v1/gocastle
rm buildlock
}

build_linux_arm64() {
sleep 1
fyne-cross linux -arch=amd64,arm64 -app-id fr.zwindler.gocastle

timeout=20
while [[ -e lock ]] && [[ $timeout -gt 0 ]]; do
# build is done by build_linux_amd64, wait for it to finish
timeout=120
while [[ -e buildlock ]] && [[ $timeout -gt 0 ]]; do
sleep 1
((timeout--))
done

if [[ -e lock ]]; then
if [[ -e buildlock ]]; then
echo "Timeout: Lock file not removed after 20 seconds."
exit 1
fi

extract_and_move fyne-cross/dist/linux-arm64/gocastle.tar.xz dist/gocastle_linux_arm64/
mkdir -p dist/gocastle_linux_arm64/
cp fyne-cross/bin/linux-arm64/gocastle dist/gocastle_linux_arm64/gocastle
}

build_android() {
fyne-cross android -arch=arm64 -app-id fr.zwindler.gocastle
mkdir -p dist/gocastle_android_arm64/
cp fyne-cross/dist/android-arm64/gocastle.apk dist/gocastle_android_arm64/
}

build_windows() {
fyne-cross windows -app-id fr.zwindler.gocastle
unzip fyne-cross/dist/windows-amd64/gocastle.exe.zip -d dist/gocastle_windows_amd64_v1/
mkdir -p dist/gocastle_windows_amd64_v1/
cp fyne-cross/bin/windows-amd64/gocastle.exe dist/gocastle_windows_amd64_v1/
}

if [[ "$4" == *"/gocastle_linux_amd64_v1/gocastle" ]]; then
Expand All @@ -54,7 +48,7 @@ elif [[ "$4" == *"/gocastle_linux_arm64/gocastle" ]]; then
build_linux_arm64
elif [[ "$4" == *"/gocastle_android_arm64/gocastle" ]]; then
build_android
elif [[ "$4" == *"/gocastle_windows_amd64_v1/gocastle" ]]; then
elif [[ "$4" == *"/gocastle_windows_amd64_v1/gocastle.exe" ]]; then
build_windows
else
echo "Invalid or unsupported path argument."
Expand Down

0 comments on commit b59f7ed

Please sign in to comment.