add goreleaser
ci/woodpecker/push/goreleaser Pipeline was successful Details
ci/woodpecker/tag/goreleaser Pipeline was successful Details

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main v0.0.1
jolheiser 2022-10-10 11:52:00 -05:00
parent 7ed7a54834
commit b6ea5fbb50
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
3 changed files with 74 additions and 1 deletions

25
.goreleaser.yaml 100644
View File

@ -0,0 +1,25 @@
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
ldflags:
- "-s -w -X main.Version={{.Version}}"
archives:
- replacements:
386: i386
amd64: x86_64
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
release:
gitea:
owner: jolheiser
name: caniuse
gitea_urls:
api: https://git.jojodev.com/api/v1/
download: https://git.jojodev.com

View File

@ -0,0 +1,39 @@
clone:
git:
image: woodpeckerci/plugin-git
settings:
tags: true
pipeline:
compliance:
image: golang:1.18
commands:
- go test -race ./...
- go vet ./...
- go run github.com/rs/zerolog/cmd/lint@latest go.jolheiser.com/caniuse
when:
event: pull_request
build:
image: goreleaser/goreleaser
commands:
- goreleaser build --snapshot
when:
event: pull_request
release:
image: goreleaser/goreleaser
commands:
- goreleaser release
secrets: [ gitea_token ]
when:
event: tag
prune:
image: jolheiser/drone-gitea-prune
settings:
base: https://git.jojodev.com
token:
from_secret: gitea_token
when:
event: tag

11
main.go
View File

@ -19,6 +19,7 @@ import (
)
var (
Version = "develop"
resultmap = map[string]string{
"y": "✔",
"n": "✘",
@ -44,11 +45,19 @@ var (
func main() {
fs := flag.NewFlagSet("caniuse", flag.ContinueOnError)
versionFlag := fs.Bool("version", false, "Show the CLI version and exit")
fs.BoolVar(versionFlag, "v", *versionFlag, "--version")
if err := ff.Parse(fs, os.Args[1:],
ff.WithEnvVarPrefix("CANIUSE"),
); err != nil {
panic(err)
fmt.Println(err)
return
}
if *versionFlag {
fmt.Printf("caniuse %s", Version)
return
}
if fs.NArg() != 1 {