Skip to content

Commit

Permalink
Now define aisap-go version in build.zig.zon
Browse files Browse the repository at this point in the history
  • Loading branch information
mgord9518 committed Oct 2, 2023
1 parent 5ceab20 commit ffb73c1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions appimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ type AppImage struct {
}

// Current version of aisap
const (
Version = "0.9.7-alpha"
// Defined in `zig/build.zig.zon`
// When using aisap as a library, `--ldflags="-X github.com/mgord9518/aisap.Version=[VERSION HERE]"`
// should be updated to the value contained in build.zig.zon
var (
Version = "UNDEFINED"
)

// Create a new AppImage object from a path
Expand Down
7 changes: 5 additions & 2 deletions resources/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

[ -z "$ARCH" ] && ARCH=$(uname -m)
PATH="$PATH:$HOME/.local/bin"
export VERSION=$(cat zig/build.zig.zon | grep '.version' | cut -d'"' -f2)

if [ ! $(command -v 'go') ]; then
echo 'Failed to locate GoLang compiler! Unable to build'
Expand Down Expand Up @@ -31,7 +32,10 @@ replace github.com/mgord9518/aisap/helpers => ../../helpers
' >> go.mod
go mod tidy

CGO_ENABLED=0 go build -ldflags '-s -w' -o '../../AppDir/usr/bin'
CGO_ENABLED=0 go build \
-o '../../AppDir/usr/bin' \
--ldflags="-sw -X github.com/mgord9518/aisap.Version=$VERSION"

[ $? -ne 0 ] && exit $?
cd ../..

Expand Down Expand Up @@ -69,7 +73,6 @@ ln -s './usr/bin/aisap' 'AppDir/AppRun'

# Build the AppImage
export ARCH="$ARCH"
export VERSION=$('AppDir/usr/bin/aisap' --version)

# Set arch
sed -i 's/X-AppImage-Architecture.*/X-AppImage-Architecture=x86_64/' 'AppDir/io.github.mgord9518.aisap.desktop'
Expand Down
2 changes: 1 addition & 1 deletion zig/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.{
.name = "aisap",
.version = "0.9.7-alpha",
.version = "0.9.8-alpha",
}

0 comments on commit ffb73c1

Please sign in to comment.