mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-27 09:15:05 +03:00
refactor!: serve the static frontend trough the backend (#520)
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
57
scripts/development/build-binaries.sh
Normal file
57
scripts/development/build-binaries.sh
Normal file
@@ -0,0 +1,57 @@
|
||||
set -eu
|
||||
cd backend
|
||||
mkdir -p .bin
|
||||
|
||||
# Function to build for a specific platform
|
||||
build_platform() {
|
||||
target=$1
|
||||
os=$2
|
||||
arch=$3
|
||||
arm_version=${4:-""}
|
||||
pocket_id_version=$(cat ../.version)
|
||||
|
||||
# Set the binary extension to exe for Windows
|
||||
binary_ext=""
|
||||
if [ "$os" = "windows" ]; then
|
||||
binary_ext=".exe"
|
||||
fi
|
||||
|
||||
output_dir=".bin/pocket-id-${target}${binary_ext}"
|
||||
|
||||
printf "Building %s/%s%s" "$os" "$arch" "$([ -n "$arm_version" ] && echo " GOARM=$arm_version" || echo "")... "
|
||||
|
||||
# Build environment variables
|
||||
env_vars="GOOS=${os} GOARCH=${arch}"
|
||||
if [ -n "$arm_version" ]; then
|
||||
env_vars="${env_vars} GOARM=${arm_version}"
|
||||
fi
|
||||
|
||||
# Build the binary
|
||||
eval "${env_vars} go build \
|
||||
-ldflags='-X github.com/pocket-id/pocket-id/backend/internal/common.Version=${pocket_id_version}' \
|
||||
-o \"${output_dir}\" \
|
||||
-trimpath \
|
||||
./cmd"
|
||||
|
||||
printf "Done\n"
|
||||
}
|
||||
|
||||
# linux builds
|
||||
build_platform "linux-amd64" "linux" "amd64" ""
|
||||
build_platform "linux-386" "linux" "386" ""
|
||||
build_platform "linux-arm64" "linux" "arm64" ""
|
||||
build_platform "linux-armv7" "linux" "arm" "7"
|
||||
|
||||
# macOS builds
|
||||
build_platform "macos-x64" "darwin" "amd64" ""
|
||||
build_platform "macos-arm64" "darwin" "arm64" ""
|
||||
|
||||
# Windows builds
|
||||
build_platform "windows-x64" "windows" "amd64" ""
|
||||
build_platform "windows-arm64" "windows" "arm64" ""
|
||||
|
||||
# FreeBSD builds
|
||||
build_platform "freebsd-amd64" "freebsd" "amd64" ""
|
||||
build_platform "freebsd-arm64" "freebsd" "arm64" ""
|
||||
|
||||
echo "Compilation done"
|
||||
@@ -112,7 +112,7 @@ fi
|
||||
|
||||
# Create the release on GitHub
|
||||
echo "Creating GitHub release..."
|
||||
gh release create "v$NEW_VERSION" --title "v$NEW_VERSION" --notes "$CHANGELOG"
|
||||
gh release create "v$NEW_VERSION" --title "v$NEW_VERSION" --notes "$CHANGELOG" --draft
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "GitHub release created successfully."
|
||||
|
||||
Reference in New Issue
Block a user