From 708147abc32578d90004b9c6f12ed9e4ba195959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Thu, 13 Jan 2022 15:15:16 +0100 Subject: [PATCH] Add pipeline --- .gitignore | 4 +++- .goreleaser.yaml | 30 ++++++++++++++++++++++++++++++ .woodpecker.yml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 2 +- version.go | 2 +- 5 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 .goreleaser.yaml create mode 100644 .woodpecker.yml diff --git a/.gitignore b/.gitignore index a8db187..26610a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -dogtamer.toml \ No newline at end of file +dogtamer.toml +gitea_token +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..c9b7a08 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,30 @@ +# 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 +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:' diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..4d8f79e --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,46 @@ +pipeline: + test_short: + image: golang:latest + commands: + - go build cmd/dogtamer.go + - go test -v ./... + when: + event: [pull_request, push] + + 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/Dockerfile b/Dockerfile index 9fd4c0f..d62c7a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:latest as builder +FROM golang:alpine as builder WORKDIR /app COPY go.mod /app/go.mod COPY go.sum /app/go.sum diff --git a/version.go b/version.go index 04aaf7e..4adb456 100644 --- a/version.go +++ b/version.go @@ -2,7 +2,7 @@ package dogtamer import "fmt" -const Version string = "v0.1.10" +const Version string = "v0.1.11" var Build string