Add GoReleaser configuration and update Makefile for streamlined builds
Some checks failed
Release Tag / release (push) Failing after 46s
Some checks failed
Release Tag / release (push) Failing after 46s
- Introduced .goreleaser.yaml for automated release management. - Updated Makefile to utilize GoReleaser for building the jiggablend binary. - Added new workflows for release tagging and pull request checks in Gitea. - Updated dependencies in go.mod and go.sum, including new packages for versioning. - Enhanced .gitignore to exclude build artifacts in the dist directory.
This commit is contained in:
24
.gitea/workflows/release-tag.yaml
Normal file
24
.gitea/workflows/release-tag.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Release Tag
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: git fetch --force --tags
|
||||
- uses: actions/setup-go@main
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
- uses: goreleaser/goreleaser-action@master
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: 'latest'
|
||||
args: release
|
||||
env:
|
||||
GITEA_TOKEN: ${{secrets.RELEASE_TOKEN}}
|
||||
15
.gitea/workflows/test-pr.yaml
Normal file
15
.gitea/workflows/test-pr.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
name: PR Check
|
||||
on:
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
check-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- uses: actions/setup-go@main
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
- run: go mod tidy
|
||||
- run: go build ./...
|
||||
- run: go test -race -v -shuffle=on ./...
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -65,6 +65,7 @@ lerna-debug.log*
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
/dist/
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
|
||||
48
.goreleaser.yaml
Normal file
48
.goreleaser.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
version: 2
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy -v
|
||||
- sh -c "cd web && npm install && npm run build"
|
||||
|
||||
builds:
|
||||
- id: default
|
||||
main: ./cmd/jiggablend
|
||||
binary: jiggablend
|
||||
ldflags:
|
||||
- -X jiggablend/version.Version={{.Version}}
|
||||
- -X jiggablend/version.Date={{.Date}}
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
|
||||
checksum:
|
||||
name_template: "checksums.txt"
|
||||
|
||||
archives:
|
||||
- id: default
|
||||
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
|
||||
formats: tar.gz
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
formats: zip
|
||||
files:
|
||||
- README.md
|
||||
- LICENSE
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- "^docs:"
|
||||
- "^test:"
|
||||
|
||||
release:
|
||||
name_template: "{{ .ProjectName }}-{{ .Version }}"
|
||||
|
||||
gitea_urls:
|
||||
api: https://git.s1d3sw1ped.com/api/v1
|
||||
download: https://git.s1d3sw1ped.com
|
||||
50
Makefile
50
Makefile
@@ -1,12 +1,11 @@
|
||||
.PHONY: build build-web run run-manager run-runner cleanup cleanup-manager cleanup-runner kill-all clean-bin clean-web test help install
|
||||
.PHONY: build build-web run run-manager run-runner cleanup cleanup-manager cleanup-runner clean-bin clean-web test help install
|
||||
|
||||
# Build the jiggablend binary (includes embedded web UI)
|
||||
build: clean-bin build-web
|
||||
go build -o bin/jiggablend ./cmd/jiggablend
|
||||
|
||||
# Build for Linux (cross-compile)
|
||||
build-linux: clean-bin build-web
|
||||
GOOS=linux GOARCH=amd64 go build -o bin/jiggablend ./cmd/jiggablend
|
||||
build:
|
||||
@echo "Building with GoReleaser..."
|
||||
goreleaser build --clean --snapshot --single-target
|
||||
@mkdir -p bin
|
||||
@find dist -name jiggablend -type f -exec cp {} bin/jiggablend \;
|
||||
|
||||
# Build web UI
|
||||
build-web: clean-web
|
||||
@@ -27,10 +26,6 @@ cleanup-runner:
|
||||
# Cleanup both manager and runner logs
|
||||
cleanup: cleanup-manager cleanup-runner
|
||||
|
||||
# Kill all jiggablend processes
|
||||
kill-all:
|
||||
@echo "Not implemented"
|
||||
|
||||
# Run manager and runner in parallel (for testing)
|
||||
run: cleanup build init-test
|
||||
@echo "Starting manager and runner in parallel..."
|
||||
@@ -74,37 +69,30 @@ clean-web:
|
||||
test:
|
||||
go test ./... -timeout 30s
|
||||
|
||||
# Install to /usr/local/bin
|
||||
install: build
|
||||
sudo cp bin/jiggablend /usr/local/bin/
|
||||
|
||||
# Show help
|
||||
help:
|
||||
@echo "Jiggablend Build and Run Makefile"
|
||||
@echo ""
|
||||
@echo "Build targets:"
|
||||
@echo " build - Build jiggablend binary with embedded web UI"
|
||||
@echo " build-linux - Cross-compile for Linux amd64"
|
||||
@echo " build-web - Build web UI only"
|
||||
@echo " build - Build jiggablend binary with embedded web UI"
|
||||
@echo " build-web - Build web UI only"
|
||||
@echo ""
|
||||
@echo "Run targets:"
|
||||
@echo " run - Run manager and runner in parallel (for testing)"
|
||||
@echo " run-manager - Run manager server"
|
||||
@echo " run-runner - Run runner with test API key"
|
||||
@echo " init-test - Initialize test configuration (run once)"
|
||||
@echo " run - Run manager and runner in parallel (for testing)"
|
||||
@echo " run-manager - Run manager server"
|
||||
@echo " run-runner - Run runner with test API key"
|
||||
@echo " init-test - Initialize test configuration (run once)"
|
||||
@echo ""
|
||||
@echo "Cleanup targets:"
|
||||
@echo " cleanup - Clean all logs"
|
||||
@echo " cleanup-manager - Clean manager logs"
|
||||
@echo " cleanup-runner - Clean runner logs"
|
||||
@echo " kill-all - Kill all running jiggablend processes"
|
||||
@echo " cleanup - Clean all logs"
|
||||
@echo " cleanup-manager - Clean manager logs"
|
||||
@echo " cleanup-runner - Clean runner logs"
|
||||
@echo ""
|
||||
@echo "Other targets:"
|
||||
@echo " clean-bin - Clean build artifacts"
|
||||
@echo " clean-web - Clean web build artifacts"
|
||||
@echo " test - Run Go tests"
|
||||
@echo " install - Install to /usr/local/bin"
|
||||
@echo " help - Show this help"
|
||||
@echo " clean-bin - Clean build artifacts"
|
||||
@echo " clean-web - Clean web build artifacts"
|
||||
@echo " test - Run Go tests"
|
||||
@echo " help - Show this help"
|
||||
@echo ""
|
||||
@echo "CLI Usage:"
|
||||
@echo " jiggablend manager serve - Start the manager server"
|
||||
|
||||
@@ -32,4 +32,3 @@ func exitWithError(msg string, args ...interface{}) {
|
||||
fmt.Fprintf(os.Stderr, "Error: "+msg+"\n", args...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
||||
25
cmd/jiggablend/cmd/version.go
Normal file
25
cmd/jiggablend/cmd/version.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"jiggablend/version"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print the version information",
|
||||
Long: `Print the version and build date of jiggablend.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Printf("jiggablend version %s\n", version.Version)
|
||||
if version.Date != "" {
|
||||
fmt.Printf("Build date: %s\n", version.Date)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"os"
|
||||
|
||||
"jiggablend/cmd/jiggablend/cmd"
|
||||
_ "jiggablend/version"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -11,4 +12,3 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4
go.mod
4
go.mod
@@ -4,6 +4,8 @@ go 1.25.4
|
||||
|
||||
require (
|
||||
github.com/go-chi/chi/v5 v5.2.3
|
||||
github.com/go-chi/cors v1.2.2
|
||||
github.com/golang-migrate/migrate/v4 v4.19.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/gorilla/websocket v1.5.3
|
||||
github.com/mattn/go-sqlite3 v1.14.32
|
||||
@@ -17,9 +19,7 @@ require (
|
||||
cloud.google.com/go/compute/metadata v0.5.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||
github.com/go-chi/cors v1.2.2 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
|
||||
github.com/golang-migrate/migrate/v4 v4.19.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
|
||||
6
go.sum
6
go.sum
@@ -1,5 +1,3 @@
|
||||
cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc=
|
||||
cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k=
|
||||
cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY=
|
||||
cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||
@@ -34,8 +32,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
|
||||
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
|
||||
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
|
||||
github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
|
||||
|
||||
16
version/version.go
Normal file
16
version/version.go
Normal file
@@ -0,0 +1,16 @@
|
||||
// version/version.go
|
||||
package version
|
||||
|
||||
import "time"
|
||||
|
||||
var Version string
|
||||
var Date string
|
||||
|
||||
func init() {
|
||||
if Version == "" {
|
||||
Version = "0.0.0-dev"
|
||||
}
|
||||
if Date == "" {
|
||||
Date = time.Now().Format("2006-01-02 15:04:05")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user