Skip to content

Commit

Permalink
Integrate packagecloud
Browse files Browse the repository at this point in the history
Use Goreleaser to build vrious deb and rpm packages and upload them to a
repository on packagecloud.
  • Loading branch information
Christian Haeusler committed Feb 28, 2019
1 parent 7f767db commit 647cfe8
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@

### Goreleaser
/dist/

### CI
/cc-test-reporter
4 changes: 4 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ builds:
goos:
- darwin
- linux

goarch:
- amd64
- 386
- arm

archive:
files:
Expand Down Expand Up @@ -35,5 +38,6 @@ nfpm:

formats:
- deb
- rpm

bindir: /usr/bin
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ go:
branches:
only:
- master
- /^v.*$/

os:
- linux
Expand All @@ -14,6 +15,15 @@ os:
env:
- GO111MODULE=on

addons:
apt:
packages:
- rpm

cache:
directories:
- vendor

before_script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then chmod +x ./cc-test-reporter; fi
Expand All @@ -27,3 +37,13 @@ script:

after_script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi

before_deploy:
- rvm $(travis_internal_ruby) --fuzzy do ruby -S gem install package_cloud

deploy:
- provider: script
script: GORELEASER='curl -sL https://git.io/goreleaser | bash -s --' make release
on:
tags: true
condition: $TRAVIS_OS_NAME = linux
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ SHELL := bash
# Environment variables
# ---------------------

GOPATH ?= $(shell go env GOPATH)
GOPATH ?= $(shell go env GOPATH)
GORELEASER ?= goreleaser

# ------------------
# Internal variables
Expand Down Expand Up @@ -42,11 +43,21 @@ $(binary_name): $(wildcard **/*.go)

.PHONY: release
release:
goreleaser --rm-dist
$(GORELEASER) --rm-dist
package_cloud push corvus-ch/tools/ubuntu/xenial dist/bilocation_*_linux_*.deb
package_cloud push corvus-ch/tools/ubuntu/bionic dist/bilocation_*_linux_*.deb
package_cloud push corvus-ch/tools/debian/stretch dist/bilocation_*_linux_armv6.deb
package_cloud push corvus-ch/tools/debian/buster dist/bilocation_*_linux_*.deb
package_cloud push corvus-ch/tools/raspbian/stretch dist/bilocation_*_linux_armv6.deb
package_cloud push corvus-ch/tools/raspbian/buster dist/bilocation_*_linux_armv6.deb
package_cloud push corvus-ch/tools/el/6 dist/bilocation_*_linux_*.rpm
package_cloud push corvus-ch/tools/el/7 dist/bilocation_*_linux_*.rpm
package_cloud push corvus-ch/tools/fedora/28 dist/bilocation_*_linux_*.rpm
package_cloud push corvus-ch/tools/fedora/29 dist/bilocation_*_linux_*.rpm

.PHONY: snapshot
snapshot:
goreleaser --rm-dist --snapshot
$(GORELEASER) --rm-dist --snapshot

.PHONY: protobuf
protobuf: tag/internal/bilocation.pb.go
Expand Down
22 changes: 17 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
image:https://travis-ci.org/corvus-ch/bilocation.svg?branch=master["Build Status", link="https://travis-ci.org/corvus-ch/bilocation"]
image:https://api.codeclimate.com/v1/badges/31917c2baffbbfa739c3/maintainability["Maintainability", link="https://codeclimate.com/github/corvus-ch/bilocation/maintainability"]
image:https://api.codeclimate.com/v1/badges/31917c2baffbbfa739c3/test_coverage["Test Coverage", link="https://codeclimate.com/github/corvus-ch/bilocation/test_coverage"]
image:https://img.shields.io/badge/deb-packagecloud.io-844fec.svg['DEB Repository, link="https://packagecloud.io/corvus-ch/tools"]
image:https://img.shields.io/badge/rpm-packagecloud.io-844fec.svg['RPM Repository, link="https://packagecloud.io/corvus-ch/tools"]

This file should go into location _A_. But wait, it also belongs to location
_B_. If you face this issue regularly while managing your files, `bilocation`
Expand All @@ -15,18 +17,28 @@ uses tags instead.

=== Install the pre-compiled binary

==== OS X
==== Homebrew

[source,bash]
----
brew install corvus-ch/tools/bilocation
----

==== Debian/Ubuntu
==== deb

Download the .deb from the
https://github.com/corvus-ch/bilocation/releases/latest[latest release] and
install with `dpkg -i`.
[source,bash]
----
curl -s https://packagecloud.io/install/repositories/corvus-ch/tools/script.deb.sh | sudo bash
apt install bilocation
----

==== rpm

[source,bash]
----
curl -s https://packagecloud.io/install/repositories/corvus-ch/tools/script.rpm.sh | sudo bash
yum install bilocation
----

=== Compiling from source

Expand Down

0 comments on commit 647cfe8

Please sign in to comment.