From 4c4e01ddb72002aee0d71cc5883cdec5ff55df16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Thu, 13 Jan 2022 18:37:39 +0100 Subject: [PATCH] Add goreleaser --- .gitignore | 3 ++- .goreleaser.yaml | 36 +++++++++++++++++++++++++++++++++ .woodpecker.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++ .woodpecker/push.yml | 18 ----------------- .woodpecker/test.yml | 15 -------------- ezshare/version.go | 2 +- 6 files changed, 87 insertions(+), 35 deletions(-) create mode 100644 .goreleaser.yaml create mode 100644 .woodpecker.yml delete mode 100644 .woodpecker/push.yml delete mode 100644 .woodpecker/test.yml diff --git a/.gitignore b/.gitignore index 07cfe30..909489c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ tmp/* dist/* ezshare.toml -ezshare.test.toml \ No newline at end of file +ezshare.test.toml +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..e8adc61 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,36 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + goarch: + - amd64 + main: ./main.go +archives: + - format_overrides: + - goos: windows + format: zip +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' +gitea_urls: + api: https://git.t-juice.club/api/v1/ + download: https://git.t-juice.club +env_files: + gitea_token: gitea_token diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..00b930c --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,48 @@ +pipeline: + test: + image: golang:alpine + commands: + - go build main.go + - go test -v ./... + - go vet ./... + when: + branch: master + event: [push, pull_request, tag, deployment] + + image-latest: + image: plugins/docker + settings: + repo: registry.t-juice.club/peckertest + registry: registry.t-juice.club + username: woodpecker + password: + from_secret: registry_password + tags: + - latest + - "${CI_COMMIT_SHA:0:8}" + when: + branch: master + event: push + + image-tagged: + image: plugins/docker + settings: + repo: registry.t-juice.club/peckertest + registry: registry.t-juice.club + username: woodpecker + password: + from_secret: registry_password + tags: + - "${CI_COMMIT_TAG}" + when: + event: [tag] + + goreleaser-tagged: + image: goreleaser/goreleaser + commands: + - git fetch --tags + - echo "$GITEA_TOKEN" > gitea_token + - goreleaser release + when: + event: [tag] + secrets: [gitea_token] diff --git a/.woodpecker/push.yml b/.woodpecker/push.yml deleted file mode 100644 index c3fede3..0000000 --- a/.woodpecker/push.yml +++ /dev/null @@ -1,18 +0,0 @@ -pipeline: - tag: - image: alpine:latest - commands: - - cat ezshare/version.go |grep Vers|cut -d "=" -f2 | tr -d " v\""|xargs echo "latest,"|tr -d " " > .tags - - cat .tags - when: - event: [tag] - - publish: - image: plugins/docker - settings: - repo: registry.t-juice.club/ezshare - username: woodpecker - password: - from_secret: registrypass - when: - event: [tag] diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml deleted file mode 100644 index 0adc81a..0000000 --- a/.woodpecker/test.yml +++ /dev/null @@ -1,15 +0,0 @@ -pipeline: - test: - image: golang:${GO_VERSION} - commands: - - go build main.go - - go test -v ./... - - go vet ./... - when: - branch: master - event: [push, pull_request, tag, deployment] - -matrix: - GO_VERSION: - - "1.17" - - "latest" diff --git a/ezshare/version.go b/ezshare/version.go index 42eb276..d6b4e63 100644 --- a/ezshare/version.go +++ b/ezshare/version.go @@ -1,4 +1,4 @@ package ezshare // TODO: Maybe put this somewhere more sensible -const Version = "v0.1.9" +const Version = "v0.1.10"