Add goreleaser

This commit is contained in:
Torjus Håkestad 2022-01-13 18:37:39 +01:00
parent 14aca041ab
commit 4c4e01ddb7
6 changed files with 87 additions and 35 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ tmp/*
dist/* dist/*
ezshare.toml ezshare.toml
ezshare.test.toml ezshare.test.toml
dist/

36
.goreleaser.yaml Normal file
View File

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

48
.woodpecker.yml Normal file
View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
package ezshare package ezshare
// TODO: Maybe put this somewhere more sensible // TODO: Maybe put this somewhere more sensible
const Version = "v0.1.9" const Version = "v0.1.10"