Compare commits
No commits in common. "main" and "v0.0.1" have entirely different histories.
39
.drone.yaml
39
.drone.yaml
@ -1,39 +0,0 @@
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: Build and Release
|
||||
|
||||
steps:
|
||||
- name: setup taskfile
|
||||
image: golang:1.21
|
||||
commands:
|
||||
- sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
|
||||
- name: test
|
||||
image: golang:1.21
|
||||
commands:
|
||||
- ./bin/task test
|
||||
- name: build & package
|
||||
image: golang:1.21
|
||||
commands:
|
||||
- ./bin/task package
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
- name: release
|
||||
image: plugins/gitea-release
|
||||
settings:
|
||||
base_url: https://gitea.layla.gg
|
||||
api_key:
|
||||
from_secret: gitea_api_key
|
||||
repo: layla/gsquash
|
||||
files:
|
||||
- ./dist/gsquash.tar.gz
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
---
|
||||
kind: secret
|
||||
name: gitea_api_key
|
||||
get:
|
||||
path: secret/synology/gitea
|
||||
name: token
|
18
.gitignore
vendored
18
.gitignore
vendored
@ -1,18 +0,0 @@
|
||||
|
||||
# Go binaries and executables
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Go test and coverage files
|
||||
*.test
|
||||
*.out
|
||||
*.cover
|
||||
|
||||
# Go build and dependency directories
|
||||
/bin/
|
||||
/pkg/
|
||||
/vendor/
|
||||
/dist/
|
52
Taskfile.yml
52
Taskfile.yml
@ -1,52 +0,0 @@
|
||||
# https://taskfile.dev
|
||||
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
test:
|
||||
cmds:
|
||||
- go test -v ./...
|
||||
silent: true
|
||||
desc: Run unit tests
|
||||
clean:
|
||||
cmds:
|
||||
- go clean
|
||||
- rm -rf ./bin
|
||||
silent: true
|
||||
desc: Remove build artifacts and clean up
|
||||
build:
|
||||
env:
|
||||
VERSION: '{{.VERSION | default "0.0.0"}}'
|
||||
cmds:
|
||||
- go build -ldflags "-X main.Version=${VERSION}" -o ./bin/gsquash ./main.go
|
||||
silent: true
|
||||
package:
|
||||
deps:
|
||||
- build
|
||||
cmds:
|
||||
- mkdir -p ./dist
|
||||
- tar -czvf ./dist/gsquash.tar.gz ./bin/gsquash
|
||||
silent: true
|
||||
desc: Package the binary into a tarball
|
||||
install:
|
||||
deps:
|
||||
- build
|
||||
cmds:
|
||||
- cmd: sudo cp ./bin/gsquash /usr/local/bin/gsquash
|
||||
platforms:
|
||||
- darwin
|
||||
- linux
|
||||
- cmd: |
|
||||
cp ./bin/gsquash.exe /Program Files(x86)/gsquash/gsquash.exe
|
||||
setx PATH "%PATH%;C:\Program Files(x86)\gsquash"
|
||||
platforms:
|
||||
- windows
|
||||
silent: true
|
||||
desc: Install the binary into /usr/local/bin
|
||||
default:
|
||||
deps:
|
||||
- test
|
||||
- clean
|
||||
- build
|
||||
silent: true
|
||||
desc: Run tests, clean up and build
|
22
magefile.go
Normal file
22
magefile.go
Normal file
@ -0,0 +1,22 @@
|
||||
//go:build mage
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/magefile/mage/sh"
|
||||
)
|
||||
|
||||
// Build builds the binary
|
||||
func Build() error {
|
||||
return sh.RunV("go", "build", "-o", "gsquash", "main.go")
|
||||
}
|
||||
|
||||
// Install installs the binary
|
||||
func Install() error {
|
||||
return sh.RunV("go", "install")
|
||||
}
|
||||
|
||||
// Test runs the tests
|
||||
func Test() error {
|
||||
return sh.RunV("go", "test", "./...")
|
||||
}
|
7
main.go
7
main.go
@ -2,20 +2,17 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"gitea.layla.gg/layla/gsquash/git"
|
||||
)
|
||||
|
||||
var Version string = "0.0.1"
|
||||
|
||||
func main() {
|
||||
// Set flags
|
||||
flagset := flag.NewFlagSet("git", flag.ExitOnError)
|
||||
pull := flagset.Bool("pull", false, "Pull the latest changes from the remote")
|
||||
message := flagset.String("m", "", "The commit message")
|
||||
version := flagset.Bool("v", false, "Print the version")
|
||||
version := flagset.Bool("version", false, "Print the version")
|
||||
help := flagset.Bool("h", false, "Print the help")
|
||||
|
||||
// Parse flags
|
||||
@ -23,7 +20,7 @@ func main() {
|
||||
|
||||
// Print version
|
||||
if *version {
|
||||
fmt.Printf("gsquash version %s\n", Version)
|
||||
println("gsquash v0.0.1")
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user