feat: use goreleaser to generate linux packages

This commit is contained in:
2024-04-26 15:09:11 +02:00
parent 768393adc8
commit b56b50ff23
10 changed files with 150 additions and 51 deletions

View File

@ -1,6 +1,6 @@
LINT_ARGS ?= --timeout 5m
GORELEASER_VERSION ?= v1.13.1
GORELEASER_ARGS ?= release --snapshot --rm-dist
GORELEASER_VERSION ?= v1.25.1
GORELEASER_ARGS ?= release --snapshot --clean
GITCHLOG_ARGS ?=
SHELL := /bin/bash
JDK_PATH ?= /usr/lib/jvm/java-11-openjdk
@ -51,7 +51,7 @@ build-client: deps ## Build executable
build-android: tools/gogio/bin/gogio deps ## Build executable
mkdir -p dist
CGO_ENABLED=1 GOOS=android CGO_CFLAGS="-I${JDK_PATH}/include -I${JDK_PATH}/include/linux -w" tools/gogio/bin/gogio -target android -buildmode archive -o android/app/libs/mobile.aar -x ./cmd/mobile
( cd android && ./gradlew assembleDebug )
( cd android && VERSION_NAME=$(MKT_PROJECT_VERSION)-debug ./gradlew assembleDebug )
$(ANDROID_KEYSTORE_FILE):
keytool -genkey -noprompt \
@ -65,7 +65,7 @@ $(ANDROID_KEYSTORE_FILE):
release-android: $(ANDROID_KEYSTORE_FILE) tools/gogio/bin/gogio deps ## Build executable
mkdir -p dist
CGO_ENABLED=1 GOOS=android CGO_CFLAGS="-I${JDK_PATH}/include -I${JDK_PATH}/include/linux -w" tools/gogio/bin/gogio -target android -buildmode archive -o android/app/libs/mobile.aar -x ./cmd/mobile
( cd android && ./gradlew assemble )
( cd android && VERSION_NAME=$(MKT_PROJECT_VERSION) ./gradlew assemble )
rm -f android/app/build/outputs/apk/release/app-release-unsigned-aligned.apk
"$(ANDROID_HOME)/build-tools/$(ANDROID_BUILD_TOOLS_VERSION)/zipalign" -p 4 android/app/build/outputs/apk/release/app-release-unsigned.apk android/app/build/outputs/apk/release/app-release-unsigned-aligned.apk
"$(ANDROID_HOME)/build-tools/$(ANDROID_BUILD_TOOLS_VERSION)/apksigner" \
@ -105,23 +105,16 @@ tools/gogio/bin/gogio:
mkdir -p tools/gogio/bin
GOBIN=$(PWD)/tools/gogio/bin go install gioui.org/cmd/gogio@latest
release: gitea-release
gitea-release: .mktools build release-android
gitea-release: .mktools build-apps goreleaser release-android
rm -rf .gitea-release
mkdir -p .gitea-release
cp ./bin/desktop_amd64 .gitea-release/arcast_player_linux_amd64
$(MAKE) GOARCH=arm build-desktop
cp ./bin/desktop_arm .gitea-release/arcast_player_linux_arm
$(MAKE) GOARCH=arm64 build-desktop
cp ./bin/desktop_arm64 .gitea-release/arcast_player_linux_arm64
cp ./bin/client .gitea-release/arcast_client_linux_amd64
cp ./android/app/build/outputs/apk/release/app-release.apk .gitea-release/arcast_player.apk
cp ./dist/*.apk .gitea-release/
cp ./dist/*.deb .gitea-release/
cp ./dist/*.tar.gz .gitea-release/
cp ./android/app/build/outputs/apk/release/app-release.apk .gitea-release/arcast_player_$(MKT_PROJECT_VERSION)_android.apk
MKT_GITEA_RELEASE_PROJECT="arcast" \
MKT_GITEA_RELEASE_ORG="arcad" \
@ -135,6 +128,9 @@ gitea-release: .mktools build release-android
MKT_GITEA_RELEASE_ATTACHMENTS="$$(find .gitea-release/* -type f)" \
$(MAKE) mkt-gitea-release
.PHONY: goreleaser
goreleaser: .env .mktools
( set -o allexport && source .env && set +o allexport && curl -sfL https://goreleaser.com/static/run | VERSION=$(GORELEASER_VERSION) GORELEASER_CURRENT_TAG="$(MKT_PROJECT_VERSION)" bash /dev/stdin $(GORELEASER_ARGS) )
.PHONY: mktools
mktools: