diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml
index e7c20a1..726b279 100644
--- a/.github/workflows/snapshot.yml
+++ b/.github/workflows/snapshot.yml
@@ -26,6 +26,3 @@ jobs:
SECRET: ${{ secrets.ELIDRAGON_UPLOAD_TOKEN }}
run: |
./upload.sh
-
-
-
diff --git a/.gitignore b/.gitignore
index 53912a6..639d6e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-build*/*
+build/*
!build/debug.sh
!build/debug_loop.sh
-dragonblocks_alpha*
+snapshot/*
diff --git a/README.md b/README.md
index 4f35060..aa88c0d 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
A multiplayer voxelgame for POSIX systems.
It has been ported to Linux, Windows, FreeBSD and OpenBSD, but may work on other systems.
-Head to for snapshot and release builds (CURRENTLY DOWN).
+Head to for snapshot and release builds.
## Invocation
diff --git a/snapshot.sh b/snapshot.sh
index 05e9bd7..d1d31a1 100755
--- a/snapshot.sh
+++ b/snapshot.sh
@@ -1,48 +1,49 @@
#!/bin/bash
set -e
-VERSION=`git tag --points-at HEAD`
-if [[ $VERSION = "" ]]; then
- VERSION=`git rev-parse --short HEAD`
-fi
+version="$(git describe --tags)"
+
+mkdir "snapshot"
+cd "snapshot"
+
+build="build"
+snapshot="dragonblocks_alpha-$version"
+toolchain=""
+dotexe=""
+dotsh=".sh"
+flags="-Ofast"
-BUILD=build-release
-SNAPSHOT=dragonblocks_alpha-$VERSION
-TOOLCHAIN=
-DOTEXE=
-DOTSH=".sh"
-FLAGS="-Ofast"
if [[ "$1" != "" ]]; then
- BUILD=build-$1
- SNAPSHOT=dragonblocks_alpha-$1-$VERSION
- TOOLCHAIN=$1.cmake
- DOTEXE=".exe"
- DOTSH=".bat"
- FLAGS="$FLAGS -static"
+ build="$build-$1"
+ snapshot="$snapshot-$1"
+ toolchain="$1.cmake"
+ dotexe=".exe"
+ dotsh=".bat"
+ flags="$flags -static"
fi
-mkdir -p $BUILD
+mkdir "$build"
-cmake -B $BUILD -S src \
+cmake -B "$build" -S ../src \
-DCMAKE_BUILD_TYPE="Release" \
-DASSET_PATH="assets/" \
- -DCMAKE_C_FLAGS="$FLAGS" \
- -DCMAKE_CXX_FLAGS="$FLAGS" \
- -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN"
+ -DCMAKE_C_FLAGS="$flags" \
+ -DCMAKE_CXX_FLAGS="$flags" \
+ -DCMAKE_TOOLCHAIN_FILE="$toolchain"
-make --no-print-directory -C $BUILD -j$(nproc)
+make --no-print-directory -C "$build" -j"$(nproc)"
-rm -rf $SNAPSHOT
-mkdir $SNAPSHOT
+rm -rf "$snapshot"
+mkdir "$snapshot"
cp -r \
- assets \
- $BUILD/dragonblocks_client$DOTEXE \
- $BUILD/dragonblocks_server$DOTEXE \
- singleplayer$DOTSH \
- LICENSE \
- README.md \
- $SNAPSHOT
+ "../assets" \
+ "$build/dragonblocks_client$dotexe" \
+ "$build/dragonblocks_server$dotexe" \
+ "../singleplayer$dotsh" \
+ "../LICENSE" \
+ "../README.md" \
+ "$snapshot"
-rm -f $SNAPSHOT.zip
-zip -r $SNAPSHOT.zip $SNAPSHOT/*
+rm -f "$snapshot.zip"
+zip -r "$snapshot.zip" "$snapshot"/*
diff --git a/src/version.cmake b/src/version.cmake
index 5befe41..b439e8d 100644
--- a/src/version.cmake
+++ b/src/version.cmake
@@ -1,15 +1,8 @@
-execute_process(COMMAND git tag --points-at HEAD
+execute_process(COMMAND git describe --tags
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
-if("${GIT_VERSION}" STREQUAL "")
- execute_process(COMMAND git rev-parse --short HEAD
- OUTPUT_VARIABLE GIT_VERSION
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-endif()
-
configure_file(
version.h.in
${BINARY_DIR}/version.h
diff --git a/upload.sh b/upload.sh
index 9cb33a5..62e1786 100755
--- a/upload.sh
+++ b/upload.sh
@@ -1,19 +1,22 @@
#!/bin/bash
-echo "Snapshot uploading temporarily disabled"
-exit
+set -e
-VERSION=`git tag --points-at HEAD`
-IS_RELEASE="1"
-if [[ $VERSION = "" ]]; then
- VERSION=`git rev-parse --short HEAD`
- IS_RELEASE="0"
+name="$(git describe --tags)"
+path="@snapshot/dragonblocks_alpha-$name"
+ref="$(git tag --points-at HEAD)"
+release="1"
+
+if [[ "$ref" == "" ]]; then
+ ref="$(git rev-parse --short HEAD)"
+ release="0"
fi
curl -f -i -X POST -H "Content-Type: multipart/form-data" \
-F "secret=$SECRET" \
- -F "name=$VERSION" \
- -F "is_release=$IS_RELEASE" \
- -F "linux=@dragonblocks_alpha-$VERSION.zip" \
- -F "win32=@dragonblocks_alpha-win32-$VERSION.zip" \
- -F "win64=@dragonblocks_alpha-win64-$VERSION.zip" \
+ -F "name=$name" \
+ -F "ref=$ref" \
+ -F "release=$release" \
+ -F "Linux=$path.zip" \
+ -F "Win32=$path-win32.zip" \
+ -F "Win64=$path-win64.zip" \
https://elidragon.tk/dragonblocks_alpha/upload.php