feat: use goreleaser to generate linux packages
This commit is contained in:
parent
768393adc8
commit
977864073f
|
@ -0,0 +1,98 @@
|
|||
project_name: arcast
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
builds:
|
||||
- id: arcast-player
|
||||
binary: arcast-player
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
ldflags:
|
||||
- -s
|
||||
- -w
|
||||
- -X 'main.CommitRef={{ .Commit }}'
|
||||
- -X 'main.Version={{ .Version }}'
|
||||
gcflags:
|
||||
- -trimpath="${PWD}"
|
||||
asmflags:
|
||||
- -trimpath="${PWD}"
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
main: ./cmd/desktop
|
||||
- id: arcast-client
|
||||
binary: arcast-client
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
ldflags:
|
||||
- -s
|
||||
- -w
|
||||
- -X 'main.CommitRef={{ .Commit }}'
|
||||
- -X 'main.Version={{ .Version }}'
|
||||
gcflags:
|
||||
- -trimpath="${PWD}"
|
||||
asmflags:
|
||||
- -trimpath="${PWD}"
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
main: ./cmd/client
|
||||
archives:
|
||||
- id: arcast-client
|
||||
builds: ["arcast-client"]
|
||||
name_template: '{{ .ProjectName }}-client_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
||||
files:
|
||||
- README.md
|
||||
- id: arcast-player
|
||||
builds: ["arcast-player"]
|
||||
name_template: '{{ .ProjectName }}-player_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
||||
files:
|
||||
- README.md
|
||||
checksum:
|
||||
name_template: "checksums.txt"
|
||||
snapshot:
|
||||
name_template: "{{ .Version }}"
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- "^docs:"
|
||||
- "^test:"
|
||||
nfpms:
|
||||
- id: arcast-player
|
||||
builds:
|
||||
- "arcast-player"
|
||||
package_name: arcast-player
|
||||
homepage: https://forge.cadoles.com/arcad/arcast
|
||||
maintainer: Cadoles <contact@cadoles.com>
|
||||
description: |-
|
||||
Web diffusion player
|
||||
license: AGPL-3.0
|
||||
formats:
|
||||
- apk
|
||||
- deb
|
||||
dependencies:
|
||||
- chromium | chromium-browser | google-chrome-stable
|
||||
contents:
|
||||
- src: misc/packaging/player.desktop
|
||||
dst: /usr/share/applications/arcast-player.desktop
|
||||
type: config
|
||||
- src: misc/logo/icon.png
|
||||
dst: /usr/share/pixmaps/arcast-player.png
|
||||
type: config
|
||||
- id: arcast-client
|
||||
builds:
|
||||
- "arcast-client"
|
||||
package_name: arcast-client
|
||||
homepage: https://forge.cadoles.com/arcad/arcast
|
||||
maintainer: Cadoles <contact@cadoles.com>
|
||||
description: |-
|
||||
Arcast player command-line client
|
||||
license: AGPL-3.0
|
||||
formats:
|
||||
- apk
|
||||
- deb
|
28
Makefile
28
Makefile
|
@ -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 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).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:
|
||||
|
|
|
@ -3,6 +3,16 @@ plugins {
|
|||
id 'org.jetbrains.kotlin.android'
|
||||
}
|
||||
|
||||
def gitVersion() {
|
||||
def counter = 0
|
||||
def process = "git rev-list master --first-parent --count".execute()
|
||||
return process.text.toInteger()
|
||||
}
|
||||
|
||||
def versionName() {
|
||||
return System.env.VERSION_NAME ? System.env.VERSION_NAME : "0.0.0"
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.cadoles.arcast_player'
|
||||
compileSdk 34
|
||||
|
@ -11,8 +21,8 @@ android {
|
|||
applicationId "com.cadoles.arcast_player"
|
||||
minSdk 24
|
||||
targetSdk 34
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
versionCode gitVersion()
|
||||
versionName versionName()
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
|
@ -47,7 +57,6 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.10.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
|
||||
implementation 'androidx.activity:activity-compose:1.7.0'
|
||||
|
|
|
@ -5,10 +5,13 @@ import (
|
|||
"forge.cadoles.com/arcad/arcast/internal/command/client"
|
||||
)
|
||||
|
||||
var Version = "dev"
|
||||
|
||||
func main() {
|
||||
command.Main(
|
||||
"arcast",
|
||||
"Arcast cli client",
|
||||
"cli client",
|
||||
Version,
|
||||
client.Root().Subcommands...,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -5,10 +5,13 @@ import (
|
|||
"forge.cadoles.com/arcad/arcast/internal/command/player"
|
||||
)
|
||||
|
||||
var Version = "dev"
|
||||
|
||||
func main() {
|
||||
command.Main(
|
||||
"arcast",
|
||||
"Arcast desktop player",
|
||||
"desktop player",
|
||||
Version,
|
||||
player.Root().Subcommands...,
|
||||
)
|
||||
}
|
||||
|
|
3
go.mod
3
go.mod
|
@ -4,7 +4,7 @@ go 1.21.4
|
|||
|
||||
require (
|
||||
gioui.org v0.4.1
|
||||
github.com/davecgh/go-spew v1.1.1
|
||||
github.com/dschmidt/go-layerfs v0.1.0
|
||||
github.com/gioui-plugins/gio-plugins v0.0.0-20240323070753-3331d8c2df5d
|
||||
github.com/go-chi/cors v1.2.1
|
||||
github.com/gorilla/websocket v1.5.1
|
||||
|
@ -24,7 +24,6 @@ require (
|
|||
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
|
||||
github.com/charmbracelet/lipgloss v0.7.1 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||
github.com/dschmidt/go-layerfs v0.1.0 // indirect
|
||||
github.com/go-playground/locales v0.14.0 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.0 // indirect
|
||||
github.com/go-text/typesetting v0.0.0-20230803102845-24e03d8b5372 // indirect
|
||||
|
|
2
go.sum
2
go.sum
|
@ -88,6 +88,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
|
|||
github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef h1:NKxTG6GVGbfMXc2mIk+KphcH6hagbVXhcFkbTgYleTI=
|
||||
github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef/go.mod h1:tcaRap0jS3eifrEEllL6ZMd9dg8IlDpi2S1oARrQ+NI=
|
||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
|
||||
|
|
|
@ -10,11 +10,12 @@ import (
|
|||
"gitlab.com/wpetit/goweb/logger"
|
||||
)
|
||||
|
||||
func Main(name string, usage string, commands ...*cli.Command) {
|
||||
func Main(name string, usage string, version string, commands ...*cli.Command) {
|
||||
app := &cli.App{
|
||||
Name: name,
|
||||
Usage: usage,
|
||||
Commands: commands,
|
||||
Version: version,
|
||||
Before: func(ctx *cli.Context) error {
|
||||
workdir := ctx.String("workdir")
|
||||
// Switch to new working directory if defined
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Version=1.0
|
||||
Name=Arcast Player
|
||||
Comment=Web diffusion server
|
||||
Path=/usr/bin/arcast-player
|
||||
Icon=arcast-player
|
Loading…
Reference in New Issue