Improve automated distribution and release
This commit is contained in:
parent
0af4dd40bc
commit
1c7678c48e
15
Building.md
15
Building.md
|
@ -7,6 +7,21 @@
|
||||||
* [Windows Cross-Compile from Linux](#windows-cross-compile-from-linux)
|
* [Windows Cross-Compile from Linux](#windows-cross-compile-from-linux)
|
||||||
* [Old Docs](#old-docs)
|
* [Old Docs](#old-docs)
|
||||||
|
|
||||||
|
# Automated Release Scripts
|
||||||
|
|
||||||
|
For the quickest ways to fully end-to-end build Sketchy Maze for various
|
||||||
|
platforms to produce public release artifacts, see the following repos:
|
||||||
|
|
||||||
|
* [doodle-docker](https://git.kirsle.net/doodle-docker) provides a Dockerfile that
|
||||||
|
fully end-to-end releases the latest version of the game for Linux and Windows:
|
||||||
|
* Windows: .zip file
|
||||||
|
* Linux: .tar.gz, .rpm, .deb
|
||||||
|
* [flatpak](https://code.sketchymaze.com/game/flatpak) is a Flatpak manifest for
|
||||||
|
Linux distributions.
|
||||||
|
|
||||||
|
The Docker container depends on all the git servers being up, but if you have
|
||||||
|
the uber blob source code you can read the Dockerfile to see what it does.
|
||||||
|
|
||||||
# Quickstart with bootstrap.py
|
# Quickstart with bootstrap.py
|
||||||
|
|
||||||
From any Unix-like system (Fedora, Ubuntu, macOS) the bootstrap.py script
|
From any Unix-like system (Fedora, Ubuntu, macOS) the bootstrap.py script
|
||||||
|
|
52
Makefile
52
Makefile
|
@ -18,7 +18,7 @@ setup: clean
|
||||||
# `make build` to build the binary.
|
# `make build` to build the binary.
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
go build $(LDFLAGS) -i -o bin/doodle cmd/doodle/main.go
|
go build $(LDFLAGS) -i -o bin/sketchymaze cmd/doodle/main.go
|
||||||
go build $(LDFLAGS) -i -o bin/doodad cmd/doodad/main.go
|
go build $(LDFLAGS) -i -o bin/doodad cmd/doodad/main.go
|
||||||
|
|
||||||
# `make buildall` to run all build steps including doodads and bindata.
|
# `make buildall` to run all build steps including doodads and bindata.
|
||||||
|
@ -29,14 +29,14 @@ buildall: doodads bindata build
|
||||||
.PHONY: build-free
|
.PHONY: build-free
|
||||||
build-free:
|
build-free:
|
||||||
gofmt -w .
|
gofmt -w .
|
||||||
go build $(LDFLAGS) -tags="shareware" -i -o bin/doodle cmd/doodle/main.go
|
go build $(LDFLAGS) -tags="shareware" -i -o bin/sketchymaze cmd/doodle/main.go
|
||||||
go build $(LDFLAGS) -tags="shareware" -i -o bin/doodad cmd/doodad/main.go
|
go build $(LDFLAGS) -tags="shareware" -i -o bin/doodad cmd/doodad/main.go
|
||||||
|
|
||||||
# `make build-debug` to build the binary in developer mode.
|
# `make build-debug` to build the binary in developer mode.
|
||||||
.PHONY: build-debug
|
.PHONY: build-debug
|
||||||
build-debug:
|
build-debug:
|
||||||
gofmt -w .
|
gofmt -w .
|
||||||
go build $(LDFLAGS) -tags="developer" -i -o bin/doodle cmd/doodle/main.go
|
go build $(LDFLAGS) -tags="developer" -i -o bin/sketchymaze cmd/doodle/main.go
|
||||||
go build $(LDFLAGS) -tags="developer" -i -o bin/doodad cmd/doodad/main.go
|
go build $(LDFLAGS) -tags="developer" -i -o bin/doodad cmd/doodad/main.go
|
||||||
|
|
||||||
# `make bindata` generates the embedded binary assets package.
|
# `make bindata` generates the embedded binary assets package.
|
||||||
|
@ -75,21 +75,36 @@ doodads:
|
||||||
mingw: doodads bindata
|
mingw: doodads bindata
|
||||||
env CGO_ENABLED="1" CC="/usr/bin/x86_64-w64-mingw32-gcc" \
|
env CGO_ENABLED="1" CC="/usr/bin/x86_64-w64-mingw32-gcc" \
|
||||||
GOOS="windows" CGO_LDFLAGS="-lmingw32 -lSDL2" CGO_CFLAGS="-D_REENTRANT" \
|
GOOS="windows" CGO_LDFLAGS="-lmingw32 -lSDL2" CGO_CFLAGS="-D_REENTRANT" \
|
||||||
go build $(LDFLAGS_W) -i -o bin/doodle.exe cmd/doodle/main.go
|
go build $(LDFLAGS_W) -i -o bin/sketchymaze.exe cmd/doodle/main.go
|
||||||
env CGO_ENABLED="1" CC="/usr/bin/x86_64-w64-mingw32-gcc" \
|
env CGO_ENABLED="1" CC="/usr/bin/x86_64-w64-mingw32-gcc" \
|
||||||
GOOS="windows" CGO_LDFLAGS="-lmingw32 -lSDL2" CGO_CFLAGS="-D_REENTRANT" \
|
GOOS="windows" CGO_LDFLAGS="-lmingw32 -lSDL2" CGO_CFLAGS="-D_REENTRANT" \
|
||||||
go build $(LDFLAGS) -i -o bin/doodad.exe cmd/doodad/main.go
|
go build $(LDFLAGS) -i -o bin/doodad.exe cmd/doodad/main.go
|
||||||
|
|
||||||
# `make mingw-free` for Windows binary in free mode.
|
# `make mingw-free` for Windows binary in free mode.
|
||||||
.PHONY: mingw-free
|
.PHONY: mingw-free
|
||||||
mingw-free: doodads bindata
|
mingw-free: doodads bindata
|
||||||
env CGO_ENABLED="1" CC="/usr/bin/x86_64-w64-mingw32-gcc" \
|
env CGO_ENABLED="1" CC="/usr/bin/x86_64-w64-mingw32-gcc" \
|
||||||
GOOS="windows" CGO_LDFLAGS="-lmingw32 -lSDL2" CGO_CFLAGS="-D_REENTRANT" \
|
GOOS="windows" CGO_LDFLAGS="-lmingw32 -lSDL2" CGO_CFLAGS="-D_REENTRANT" \
|
||||||
go build $(LDFLAGS_W) -tags="shareware" -i -o bin/doodle.exe cmd/doodle/main.go
|
go build $(LDFLAGS_W) -tags="shareware" -i -o bin/sketchymaze.exe cmd/doodle/main.go
|
||||||
env CGO_ENABLED="1" CC="/usr/bin/x86_64-w64-mingw32-gcc" \
|
env CGO_ENABLED="1" CC="/usr/bin/x86_64-w64-mingw32-gcc" \
|
||||||
GOOS="windows" CGO_LDFLAGS="-lmingw32 -lSDL2" CGO_CFLAGS="-D_REENTRANT" \
|
GOOS="windows" CGO_LDFLAGS="-lmingw32 -lSDL2" CGO_CFLAGS="-D_REENTRANT" \
|
||||||
go build $(LDFLAGS) -tags="shareware" -i -o bin/doodad.exe cmd/doodad/main.go
|
go build $(LDFLAGS) -tags="shareware" -i -o bin/doodad.exe cmd/doodad/main.go
|
||||||
|
|
||||||
|
# `make release` runs the release.sh script, must be run
|
||||||
|
# after `make dist`
|
||||||
|
.PHONY: release
|
||||||
|
release:
|
||||||
|
./scripts/release.sh
|
||||||
|
|
||||||
|
# `make mingw-release` runs a FULL end-to-end release of Linux and Windows
|
||||||
|
# binaries of the game, zipped and tagged and ready to go.
|
||||||
|
.PHONY: mingw-release
|
||||||
|
mingw-release: doodads bindata build mingw __dist-common release
|
||||||
|
|
||||||
|
# `make osx` to cross-compile a Mac OS binary with osxcross.
|
||||||
|
# .PHONY: osx
|
||||||
|
# osx: doodads bindata
|
||||||
|
# CGO_ENABLED=1 CC=[path-to-osxcross]/target/bin/[arch]-apple-darwin[version]-clang GOOS=darwin GOARCH=[arch] go build -tags static -ldflags "-s -w" -a
|
||||||
|
|
||||||
|
|
||||||
# `make run` to run it in debug mode.
|
# `make run` to run it in debug mode.
|
||||||
|
@ -118,13 +133,14 @@ dist-free: doodads bindata build-free __dist-common
|
||||||
# Common logic behind `make dist`
|
# Common logic behind `make dist`
|
||||||
.PHONY: __dist-common
|
.PHONY: __dist-common
|
||||||
__dist-common:
|
__dist-common:
|
||||||
mkdir -p dist/doodle-$(VERSION)
|
mkdir -p dist/sketchymaze-$(VERSION)
|
||||||
cp bin/* dist/doodle-$(VERSION)/
|
cp bin/* dist/sketchymaze-$(VERSION)/
|
||||||
cp -r README.md Changes.md "Open Source Licenses.md" rtp dist/doodle-$(VERSION)/
|
cp -r README.md Changes.md "Open Source Licenses.md" rtp dist/sketchymaze-$(VERSION)/
|
||||||
rm -rf dist/doodle-$(VERSION)/rtp/.git
|
if [[ -d ./guidebook ]]; then cp -r guidebook dist/sketchymaze-$(VERSION)/; fi
|
||||||
ln -sf doodle-$(VERSION) dist/doodle-latest
|
rm -rf dist/sketchymaze-$(VERSION)/rtp/.git
|
||||||
cd dist && tar -czvf doodle-$(VERSION).tar.gz doodle-$(VERSION)
|
ln -sf sketchymaze-$(VERSION) dist/sketchymaze-latest
|
||||||
cd dist && zip -r doodle-$(VERSION).zip doodle-$(VERSION)
|
cd dist && tar -czvf sketchymaze-$(VERSION).tar.gz sketchymaze-$(VERSION)
|
||||||
|
cd dist && zip -r sketchymaze-$(VERSION).zip sketchymaze-$(VERSION)
|
||||||
|
|
||||||
# `make docker` to run the Docker builds
|
# `make docker` to run the Docker builds
|
||||||
.PHONY: docker docker.ubuntu docker.debian docker.fedora __docker.dist
|
.PHONY: docker docker.ubuntu docker.debian docker.fedora __docker.dist
|
||||||
|
|
|
@ -5,7 +5,7 @@ Name=Sketchy Maze
|
||||||
GenericName=Maze Game
|
GenericName=Maze Game
|
||||||
X-GNOME-FullName=Sketchy Maze - A drawing-based maze game
|
X-GNOME-FullName=Sketchy Maze - A drawing-based maze game
|
||||||
Comment=A drawing-based maze game.
|
Comment=A drawing-based maze game.
|
||||||
Exec=/opt/sketchy-maze/doodle
|
Exec=/opt/sketchy-maze/sketchymaze
|
||||||
Path=/opt/sketchy-maze
|
Path=/opt/sketchy-maze
|
||||||
Icon=project-doodle
|
Icon=project-doodle
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
|
|
|
@ -6,13 +6,34 @@
|
||||||
# Might need fixing over time.
|
# Might need fixing over time.
|
||||||
export PATH="$PATH:$HOME/.local/share/gem/ruby/3.0.0/bin"
|
export PATH="$PATH:$HOME/.local/share/gem/ruby/3.0.0/bin"
|
||||||
|
|
||||||
VERSION=`egrep -e 'Version\s+=' ../../pkg/branding/branding.go | head -n 1 | cut -d '"' -f 2`
|
|
||||||
INSTALL_ROOT="/opt/sketchy-maze"
|
INSTALL_ROOT="/opt/sketchy-maze"
|
||||||
LAUNCHER_FILE="../../etc/linux/net.kirsle.ProjectDoodle.desktop"
|
LAUNCHER_FILENAME="etc/linux/net.kirsle.ProjectDoodle.desktop"
|
||||||
LAUNCHER_ROOT="/usr/share/applications" # Where the .desktop file goes.
|
LAUNCHER_ROOT="/usr/share/applications" # Where the .desktop file goes.
|
||||||
ICON_ROOT="/usr/share/icons/hicolor/"
|
ICON_ROOT="/usr/share/icons/hicolor/"
|
||||||
|
|
||||||
if [[ ! -f "./doodle" ]]; then
|
# Find out how many levels up we need to go, so this
|
||||||
|
# script can run from either of these locations:
|
||||||
|
# ./dist/sketchymaze-$version/
|
||||||
|
# ./dist/stage/$version/linux/
|
||||||
|
UPLEVELS="."
|
||||||
|
if [[ -f "../../${LAUNCHER_FILENAME}" ]]; then
|
||||||
|
# run from a ./dist/x folder.
|
||||||
|
UPLEVELS="../.."
|
||||||
|
elif [[ -f "../../../../${LAUNCHER_FILENAME}" ]]; then
|
||||||
|
# run from a release stage folder
|
||||||
|
UPLEVELS="../../../.."
|
||||||
|
else
|
||||||
|
echo Did not find ${LAUNCHER_FILENAME} relative to your working directory.
|
||||||
|
echo Good places to run this script include:
|
||||||
|
echo " * ./dist/sketchymaze-\$version/ (as in 'make dist')"
|
||||||
|
echo " * ./dist/stage/\$version/linux/ (as in 'make release')"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
VERSION=`egrep -e 'Version\s+=' ${UPLEVELS}/pkg/branding/branding.go | head -n 1 | cut -d '"' -f 2`
|
||||||
|
LAUNCHER_FILE="${UPLEVELS}/${LAUNCHER_FILENAME}"
|
||||||
|
|
||||||
|
if [[ ! -f "./sketchymaze" ]]; then
|
||||||
echo Run this script from the directory containing the Doodle binary.
|
echo Run this script from the directory containing the Doodle binary.
|
||||||
echo This is usually at /dist/doodle-VERSION/ relative to the git root.
|
echo This is usually at /dist/doodle-VERSION/ relative to the git root.
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -35,11 +56,11 @@ cp $LAUNCHER_FILE root$LAUNCHER_ROOT/
|
||||||
|
|
||||||
# Copy icons in.
|
# Copy icons in.
|
||||||
mkdir -p root$ICON_ROOT/{256x256,128x128,64x64,32x32,16x16}/apps
|
mkdir -p root$ICON_ROOT/{256x256,128x128,64x64,32x32,16x16}/apps
|
||||||
cp ../../etc/icons/256.png "root${ICON_ROOT}256x256/apps/project-doodle.png"
|
cp ${UPLEVELS}/etc/icons/256.png "root${ICON_ROOT}256x256/apps/project-doodle.png"
|
||||||
cp ../../etc/icons/128.png "root${ICON_ROOT}128x128/apps/project-doodle.png"
|
cp ${UPLEVELS}/etc/icons/128.png "root${ICON_ROOT}128x128/apps/project-doodle.png"
|
||||||
cp ../../etc/icons/64.png "root$ICON_ROOT/64x64/apps/project-doodle.png"
|
cp ${UPLEVELS}/etc/icons/64.png "root$ICON_ROOT/64x64/apps/project-doodle.png"
|
||||||
cp ../../etc/icons/32.png "root$ICON_ROOT/32x32/apps/project-doodle.png"
|
cp ${UPLEVELS}/etc/icons/32.png "root$ICON_ROOT/32x32/apps/project-doodle.png"
|
||||||
cp ../../etc/icons/16.png "root$ICON_ROOT/16x16/apps/project-doodle.png"
|
cp ${UPLEVELS}/etc/icons/16.png "root$ICON_ROOT/16x16/apps/project-doodle.png"
|
||||||
|
|
||||||
# Copy runtime package and guidebook
|
# Copy runtime package and guidebook
|
||||||
cp -r guidebook rtp "root$INSTALL_ROOT/"
|
cp -r guidebook rtp "root$INSTALL_ROOT/"
|
||||||
|
|
82
scripts/release.sh
Executable file
82
scripts/release.sh
Executable file
|
@ -0,0 +1,82 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# release.sh:
|
||||||
|
# Run this AFTER `make dist` and it will carve up the dist/
|
||||||
|
# folder into Linux and Windows versions and zip them up
|
||||||
|
# for release.
|
||||||
|
#
|
||||||
|
# For Mac OS releases, after `make dist` run `release-osx.sh`
|
||||||
|
# instead.
|
||||||
|
|
||||||
|
# Add the user-level "gem install fpm" to the $PATH.
|
||||||
|
# Might need fixing over time.
|
||||||
|
export PATH="$PATH:$HOME/.local/share/gem/ruby/3.0.0/bin"
|
||||||
|
|
||||||
|
VERSION=`egrep -e 'Version\s+=' ./pkg/branding/branding.go | head -n 1 | cut -d '"' -f 2`
|
||||||
|
DIST_PATH="$(pwd)/dist/sketchymaze-${VERSION}"
|
||||||
|
RELEASE_PATH="$(pwd)/dist/release/${VERSION}"
|
||||||
|
STAGE_PATH="$(pwd)/dist/stage/${VERSION}"
|
||||||
|
|
||||||
|
if [[ ! -d $DIST_PATH ]]; then
|
||||||
|
echo Run this script from the root of the game repository, such that
|
||||||
|
echo ./dist/sketchymaze-${VERSION} exists. Run 'make mingw' and/or
|
||||||
|
echo 'make dist' to create this directory before running this script.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean previous artifacts.
|
||||||
|
if [[ -d $RELEASE_PATH ]]; then
|
||||||
|
rm -rf $RELEASE_PATH
|
||||||
|
fi
|
||||||
|
if [[ -d $STAGE_PATH ]]; then
|
||||||
|
rm -rf $STAGE_PATH
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Release scripts by operating system.
|
||||||
|
linux() {
|
||||||
|
# Check for Linux binaries in the dist folder.
|
||||||
|
if [[ ! -f "${DIST_PATH}/doodad" ]]; then
|
||||||
|
echo No Linux binaries found, skipping Linux release.
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prepare the Linux release.
|
||||||
|
mkdir -p ${STAGE_PATH} "${RELEASE_PATH}/linux"
|
||||||
|
cp -r $DIST_PATH "${STAGE_PATH}/linux"
|
||||||
|
cd "$STAGE_PATH/linux"
|
||||||
|
|
||||||
|
# Remove Windows artifacts.
|
||||||
|
rm *.exe *.dll
|
||||||
|
|
||||||
|
# Tar it.
|
||||||
|
tar -czvf "${RELEASE_PATH}/linux/sketchymaze-${VERSION}-linux-64bit.tar.gz" .
|
||||||
|
|
||||||
|
# fpm it.
|
||||||
|
../../../../scripts/fpm-bundle.sh
|
||||||
|
cp *.rpm *.deb "${RELEASE_PATH}/linux/"
|
||||||
|
|
||||||
|
# return
|
||||||
|
cd -
|
||||||
|
}
|
||||||
|
windows() {
|
||||||
|
# Check for Windows binaries in the dist folder.
|
||||||
|
if [[ ! -f "${DIST_PATH}/doodad.exe" ]]; then
|
||||||
|
echo No Windows binaries found, skipping Windows release.
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prepare the Windows release.
|
||||||
|
mkdir -p ${STAGE_PATH} "${RELEASE_PATH}/windows"
|
||||||
|
cp -r $DIST_PATH "${STAGE_PATH}/windows"
|
||||||
|
cd "$STAGE_PATH/windows"
|
||||||
|
|
||||||
|
# Remove Linux artifacts.
|
||||||
|
rm sketchymaze doodad
|
||||||
|
|
||||||
|
# Zip it.
|
||||||
|
zip -r "${RELEASE_PATH}/windows/sketchymaze-${VERSION}-windows-64bit.zip" .
|
||||||
|
cd -
|
||||||
|
}
|
||||||
|
|
||||||
|
linux
|
||||||
|
windows
|
Loading…
Reference in New Issue
Block a user