Add pipeline

This commit is contained in:
Torjus Håkestad 2022-01-13 15:15:16 +01:00
parent e62e5a878f
commit 708147abc3
5 changed files with 81 additions and 3 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
dogtamer.toml dogtamer.toml
gitea_token
dist/

30
.goreleaser.yaml Normal file
View File

@ -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:'

46
.woodpecker.yml Normal file
View File

@ -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]

View File

@ -1,4 +1,4 @@
FROM golang:latest as builder FROM golang:alpine as builder
WORKDIR /app WORKDIR /app
COPY go.mod /app/go.mod COPY go.mod /app/go.mod
COPY go.sum /app/go.sum COPY go.sum /app/go.sum

View File

@ -2,7 +2,7 @@ package dogtamer
import "fmt" import "fmt"
const Version string = "v0.1.10" const Version string = "v0.1.11"
var Build string var Build string