From c6344456e822cde1bc645886cc1350bb89176a7d Mon Sep 17 00:00:00 2001 From: jolheiser Date: Sat, 4 Jun 2022 14:50:29 -0500 Subject: [PATCH] Add goreleaser template Signed-off-by: jolheiser --- template.toml | 12 ++++----- template/.goreleaser.yaml | 25 ++++++++++++++++++ template/.tmplkeep | 1 - template/.woodpecker/goreleaser.yml | 39 +++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 template/.goreleaser.yaml delete mode 100644 template/.tmplkeep create mode 100644 template/.woodpecker/goreleaser.yml diff --git a/template.toml b/template.toml index 1507fc7..1e29c06 100644 --- a/template.toml +++ b/template.toml @@ -1,6 +1,6 @@ -# template.toml -# Write any template args here to prompt the user for, giving any defaults/options as applicable - -name = "MyProject" - -lang = ["Go", "Rust", "Python"] +gitea_url = "https://git.jojodev.com" +gitea_user = "" +gitea_repo = "" +name = "${TMPL_PROMPT_GITEA_REPO}" +module = "${TMPL_PROMPT_GITEA_URL}/${TMPL_PROMPT_GITEA_USER}/${TMPL_PROMPT_GITEA_REPO}" +version_package = "${TMPL_PROMPT_MODULE}/cmd" \ No newline at end of file diff --git a/template/.goreleaser.yaml b/template/.goreleaser.yaml new file mode 100644 index 0000000..83121c6 --- /dev/null +++ b/template/.goreleaser.yaml @@ -0,0 +1,25 @@ +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + ldflags: + - "-s -w -X {{version_package}}.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: {{gitea_repo}} +gitea_urls: + api: {{gitea_url}}/api/v1/ + download: {{gitea_url}} diff --git a/template/.tmplkeep b/template/.tmplkeep deleted file mode 100644 index b4bd1aa..0000000 --- a/template/.tmplkeep +++ /dev/null @@ -1 +0,0 @@ -Delete this file and put something else here! \ No newline at end of file diff --git a/template/.woodpecker/goreleaser.yml b/template/.woodpecker/goreleaser.yml new file mode 100644 index 0000000..589d07c --- /dev/null +++ b/template/.woodpecker/goreleaser.yml @@ -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 {{module}} + 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: {{gitea_url}} + token: + from_secret: gitea_token + when: + event: tag