mirror of
https://github.com/costela/docker-etchosts.git
synced 2025-05-10 17:35:41 +02:00
Configure go releaser and build releases for tags
This commit is contained in:
parent
46128e34d0
commit
29960797b2
6 changed files with 87 additions and 65 deletions
34
.github/workflows/go.yml
vendored
34
.github/workflows/go.yml
vendored
|
@ -3,6 +3,7 @@ name: Go
|
|||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
tags: ['*']
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
|
@ -23,3 +24,36 @@ jobs:
|
|||
|
||||
- name: Test
|
||||
run: go test -v ./...
|
||||
|
||||
publish:
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
-
|
||||
name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.16
|
||||
-
|
||||
name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
|
||||
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -14,3 +14,5 @@
|
|||
|
||||
# misc
|
||||
*.tmp
|
||||
|
||||
dist/
|
||||
|
|
48
.goreleaser.yml
Normal file
48
.goreleaser.yml
Normal file
|
@ -0,0 +1,48 @@
|
|||
# This is an example .goreleaser.yml file with some sane defaults.
|
||||
# Make sure to check the documentation at http://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
|
||||
goarch:
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
flags:
|
||||
- -trimpath
|
||||
ldflags:
|
||||
- -s -w
|
||||
dockers:
|
||||
- image_templates:
|
||||
- "costela/docker-etchosts:{{ .Tag }}"
|
||||
- "costela/docker-etchosts:{{ .Major }}"
|
||||
- "costela/docker-etchosts:{{ .Major }}.{{ .Minor }}"
|
||||
- "costela/docker-etchosts:latest"
|
||||
archives:
|
||||
- format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
replacements:
|
||||
darwin: mac
|
||||
format: binary
|
||||
checksum:
|
||||
algorithm: sha512
|
||||
snapshot:
|
||||
name_template: "{{ incpatch .Tag }}-next"
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
||||
release:
|
||||
draft: true
|
||||
prerelease: auto
|
||||
|
43
.travis.yml
43
.travis.yml
|
@ -1,43 +0,0 @@
|
|||
language: go
|
||||
|
||||
dist: xenial
|
||||
|
||||
go:
|
||||
- "1.13"
|
||||
- "1.x"
|
||||
- "master"
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: "master"
|
||||
fast_finish: true
|
||||
|
||||
script: go test -v
|
||||
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- /home/travis/gopath/pkg/mod
|
||||
|
||||
install: true # skip, handled by "cache" stage
|
||||
|
||||
stages:
|
||||
- cache
|
||||
- test
|
||||
- deploy
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: cache
|
||||
script: go mod download
|
||||
- stage: deploy
|
||||
script: skip
|
||||
env:
|
||||
- secure: "FOx2FP9HJs1AupPp2yZ84z5yaPwYSRAaT2OGoRf/RAgRtzxF0qZdi9T/IBu5Kz5b1IyMWvteIjEj2PFyKjRTkn9mASzPnk0+ymtfxdxm34TM0gXfy/3WgG4W90bNeiX3ZQ8cXliwBvBIe7HYfRz9733Q1Mh2P2NVhtWi/PlPelDbvtvTVnEArrveXln/HbnDhjVN3MdPc4eCZymQT4QtcuQ89ERdFqVGaOYGevMAYaaGJ2BgsT8I41YDCs+TkuLA3cbZmDp4Q2DvRoLrPW2MJh6fwmql+3pButDvehNE+I4OL+R1d7kWEhY9ikzvsp0x5dxyEf2PBBDv2A2z8cGb0MfQFhPvwtlc5drDrv9psqGrNjBZZ38pGWJas3kMr6yGMj1au7CaVvW16W+23XFRSuwE0s4V4ls1z5a5nUTi7Yfgi1NtJiFQq3iiSRcB1SkH/FV0UKM3Gy/grQEUywR+V0p8hO8C7QD+dFRQwg822xraCaN3oLNND5EUmA6bI9knAWZTjFMXwYfiO2W3cdWoQ3YtLlULPzNBqVAjOGgkvtnZclLyAK8iq4ygnXo+VIIOZ4EK0Ze9ibsDZHwbuX06vIoG/wbAFN9HV+WwaPE1pzfcjJ9wkhERz6OPIZlA59DRDqHSpIA45kf38VEBRTA47LT5z2ThAAbuWFWTIkBOn38="
|
||||
deploy:
|
||||
provider: script
|
||||
script: 'curl -si -H "Content-Type: application/json" --data "{\"source_type\": \"Tag\", \"source_name\": \"${TRAVIS_TAG}\"}" -X POST https://registry.hub.docker.com/u/costela/docker-etchosts/trigger/${DOCKER_HUB_TOKEN}/'
|
||||
on:
|
||||
tags: true
|
24
Dockerfile
24
Dockerfile
|
@ -1,21 +1,3 @@
|
|||
FROM golang:1.13-alpine AS build
|
||||
|
||||
RUN apk add --update git
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
RUN go mod download
|
||||
|
||||
COPY *.go /app/
|
||||
|
||||
RUN go build -v
|
||||
|
||||
FROM alpine
|
||||
|
||||
COPY --from=build /app/docker-etchosts /docker-etchosts
|
||||
|
||||
CMD [ "/docker-etchosts" ]
|
||||
FROM scratch
|
||||
ENTRYPOINT ["/docker-etchosts"]
|
||||
COPY docker-etchosts /
|
||||
|
|
1
go.sum
1
go.sum
|
@ -4,7 +4,6 @@ github.com/Microsoft/go-winio v0.4.9 h1:3RbgqgGVqmcpbOiwrjbVtDHLlJBGF6aE+yHmNtBN
|
|||
github.com/Microsoft/go-winio v0.4.9/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
|
||||
github.com/cenkalti/backoff v2.1.1+incompatible h1:tKJnvO2kl0zmb/jA5UKAt4VoEVw1qxKWjE/Bpp46npY=
|
||||
github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue