From dacfe26650f9a0908d43d183f5d1e2189effb45e Mon Sep 17 00:00:00 2001 From: jolheiser Date: Thu, 2 Jun 2022 22:23:14 -0500 Subject: [PATCH] Add goreleaser Signed-off-by: jolheiser --- .gitignore | 3 ++- .goreleaser.yaml | 25 ++++++++++++++++++++++++ .woodpecker.yml | 49 +++++++++--------------------------------------- 3 files changed, 36 insertions(+), 41 deletions(-) create mode 100644 .goreleaser.yaml diff --git a/.gitignore b/.gitignore index afb63d4..c0c7cc9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ # Binaries /tmpl -/tmpl.exe \ No newline at end of file +/tmpl.exe +dist/ \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..a672de5 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,25 @@ +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + ldflags: + - "-s -w -X go.jolheiser.com/tmpl/cmd.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: tmpl +gitea_urls: + api: https://git.jojodev.com/api/v1/ + download: https://git.jojodev.com diff --git a/.woodpecker.yml b/.woodpecker.yml index 2d9dbb0..73e9ceb 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,10 +1,6 @@ -clone: - git: - image: woodpeckerci/plugin-git:next - pipeline: compliance: - image: golang:1.17 + image: golang:1.18 commands: - go test -race ./... - go vet ./... @@ -13,47 +9,20 @@ pipeline: when: event: pull_request - build: - image: golang:1.17 + release: + image: goreleaser/goreleaser commands: - - GOOS="windows" go build - - GOOS="linux" go build + - goreleaser release + secrets: [ gitea_token ] when: event: [ push, tag ] branch: main - release-main: - image: jolheiser/drone-gitea-main:latest - secrets: - - source: gitea_token - target: plugin_token - base: https://git.jojodev.com - files: - - "tmpl" - - "tmpl.exe" - when: - event: push - branch: main - - release-tag: - image: plugins/gitea-release:1 - secrets: - - source: gitea_token - target: plugin_api_key - base_url: https://git.jojodev.com - files: - - "tmpl" - - "tmpl.exe" - when: - event: tag - tag: v* - prune: image: jolheiser/drone-gitea-prune - secrets: - - source: gitea_token - target: plugin_token - base: https://git.jojodev.com + settings: + base: https://git.jojodev.com + token: + from_secret: gitea_token when: event: tag - tag: v*