Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
Create OS packages and docker image on release. (#32)
Browse files Browse the repository at this point in the history
* Install rpm on the releaser docker image.

This is needed for nfpm to be able build the rpm package for releases.

* Push docker image with goreleaser.

* Run goreleaser on travis outside of a container.
  • Loading branch information
mtpereira authored Jun 25, 2018
1 parent b3cdd2f commit 1bc809c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 15 deletions.
26 changes: 26 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,32 @@ checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt"
changelog:
sort: asc
nfpm:
vendor: Edward Robinson
homepage: https://github.com/errm/ekstrap/
maintainer: Edward Robinson <edward-robinson@cookpad.com>
description: Bootstrap for EKS
license: Apache 2.0
formats:
- deb
- rpm
dependencies:
- dbus
- systemd
bindir: /usr/sbin
overrides:
rpm:
replacements:
amd64: x86_64
dockers:
- image: errm/ekstrap
dockerfile: Dockerfile
tag_templates:
- "{{ .Major }}"
- "{{ .Major }}.{{ .Minor }}"
- "{{ .Major }}.{{ .Minor }}.{{ .Patch }}"
- latest

# sign:
# artifacts: checksum
# cmd: /usr/bin/env gpg
Expand Down
19 changes: 14 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ language: go
go:
- "1.10.x"

addons:
apt:
packages:
- rpm

services:
- docker

Expand All @@ -12,9 +17,13 @@ before_script:
script:
- make all lint

after_success:
- test -n "$TRAVIS_TAG" && docker login -u=errm -p="$DOCKER_PASSWORD"

deploy:
- provider: script
skip_cleanup: true
script: make release
on:
tags: true
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash
on:
tags: true
condition: $TRAVIS_OS_NAME = linux
11 changes: 1 addition & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
FROM golang:1.10-alpine3.7 AS build

WORKDIR $GOPATH/src/github.com/errm/ekstrap
COPY . ./
RUN CGO_ENABLED=0 GOOS=linux \
go build \
-o /ekstrap .

FROM alpine:3.7
WORKDIR /app
COPY --from=build /ekstrap /app/
COPY ekstrap /
ENTRYPOINT ["./ekstrap"]
1 change: 1 addition & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN apk add --no-cache \
curl \
git \
upx \
rpm \
&& curl -L \
https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_Linux_x86_64.tar.gz \
| tar -xzf - -C /usr/local/bin/ \
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ install-linter:
lint:
$(GOMETALINTER)

# The following targets enable local testing of goreleaser.
build-releaser: Dockerfile.release
$(GORELEASER_BUILD)
release: build-releaser .goreleaser.yml
Expand Down

0 comments on commit 1bc809c

Please sign in to comment.