Skip to content

Commit 70cbea0

Browse files
Merge pull request #6 from monochromata/master
Use Travis CI to add binaries to release-tags of Github
2 parents a7b258a + 8f24efb commit 70cbea0

File tree

2 files changed

+98
-40
lines changed

2 files changed

+98
-40
lines changed

.travis.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Builds the docker-machine-driver-hetzner and releases it, if the build is a tag
2+
# (due to the deploy.on.tags=true below).
3+
#
4+
# To make it work, create and encrypt an OAuth token for the Github API as follows:
5+
# (1) Go to https://github.com/settings/tokens and create a new private token
6+
# with scope "public_repo".
7+
# (2) Convert the token into a Travis secret as described at
8+
# https://docs.travis-ci.com/user/encryption-keys/:
9+
# * (assuming you are on a shell with the current working directory being
10+
# inside a local working copy of your Github project)
11+
# * gem install travis
12+
# * travis encypt <the token created in step (1)>
13+
# * add the secure: "<encrypted token>" to the travis.yml file as a key
14+
# below the api_key
15+
language: go
16+
go:
17+
- 1.9
18+
19+
before_deploy:
20+
# Create binaries for many OSs and architures as tarballs.
21+
# the -osarch="!a/b !c/d" option is used to exclude OS-arch pairs
22+
# a/b and c/d from the build. OS-arch pairs might e.g. be excluded
23+
# they failed to build.
24+
- go get github.com/mitchellh/gox
25+
- mkdir releases
26+
- gox -osarch="!netbsd/arm !openbsd/386 !openbsd/amd64 !netbsd/386 !netbsd/amd64" -output="releases/{{.Dir}}_`git describe --tags --abbrev=0`_{{.OS}}_{{.Arch}}/{{.Dir}}"
27+
# Below tar command will log an error because either ...-hetzner or
28+
# ...-hetzner.exe are missing. The process continues, though and the
29+
# created tarballs are fine.
30+
- find releases -maxdepth 1 -mindepth 1 -type d -exec tar -cvzf {}.tar.gz -C {} docker-machine-driver-hetzner docker-machine-driver-hetzner.exe \;
31+
32+
deploy:
33+
# See https://docs.travis-ci.com/user/deployment/releases/
34+
provider: releases
35+
api_key:
36+
secure: "axqqN9jR04SeVkHJXLRFPGECdXWcryMMgQXtN5G5vBXyN4jaEl0L6uMxxRxO/v+XQc71lS3YR+6vgpqYgK5PSEORi8EDzGaiEzZN2Zg1YKX1vCP+n5FykKu+v/+j+S/ZCNI+gvW4hhgb4vFXzcy3OF/CKSKlzfIM9Gqx8VtHQ+C3EQPkW1xgpVoGmenU505DipDJHQkE99WTtUmV34hQagOcDDEUMotCEn653YOeuPMUpprmfpwthAtZbKNls//+TUWboYzLkqQlym0vuSnDVXCIxTjAtakAIhnPQfynh6DGVkQhdVSPD8epo1o36/K4DQrf49Mj+yIZxhJ9o27XPHPdnsnpslrZZl0ayQw4GHGwMq4eRUGxW/fLE64sCO18JZMd5qtU9K/z9cAcS480uZI0yzD94xROcvMeBxxGyt/aQU0oqnu/3b7QPzU0DR824gmBgtVCBkrg58pTMKHn5U+BosZjBjMMWcj8WAzVuJt7P81gMIzc7m7cpU2NWf5Z3RgBFgD4EfZrmCnlENzgMyXkWkqJYpVGOBB/DblTLp4t8v8T07QCBcD2oWd/dLvc816Ot0FXyIttQEhpEMRlYBpUSBjR5Nov8hYQdFebKUB+nDJoC+L73okf2BdST4v/LCN86bNregHL1DxRNB84vlSeMM2bC31DuiD0Z+dX7VI="
37+
file_glob: true # enables wildcards in file names
38+
file: "releases/*.tar.gz"
39+
skip_cleanup: true
40+
on:
41+
tags: true

README.md

Lines changed: 57 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,46 @@
22

33
[![Go Report Card](https://goreportcard.com/badge/github.com/JonasProgrammer/docker-machine-driver-hetzner)](https://goreportcard.com/report/github.com/JonasProgrammer/docker-machine-driver-hetzner)
44
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5+
[![Build Status](https://secure.travis-ci.org/JonasProgrammer/docker-machine-driver-hetzner.png)](http://travis-ci.org/JonasProgrammer/docker-machine-driver-hetzner)
56

67
> This library adds the support for creating [Docker machines](https://github.com/docker/machine) hosted on the [Hetzner Cloud](hetzner.de/cloud).
78
8-
You need to create a project-sepcific access token under `Access` > `API Tokens` in the project control panel
9+
You need to create a project-specific access token under `Access` > `API Tokens` in the project control panel
910
and pass that to `docker-machine create` with the `--hetzner-api-token` option.
1011

12+
## Installation
1113

12-
## Building
14+
You can find sources and pre-compiled binaries [here](https://github.com/JonasProgrammer/docker-machine-driver-hetzner/releases).
1315

14-
Use an up-to-date version of [go](https://golang.org/dl)
15-
16-
To use the driver, you can download the sources and build it locally:
17-
18-
# Get sources and build the binary at ~/go/bin/docker-machine-driver-hetzner
19-
go get github.com/jonasprogrammer/docker-machine-driver-hetzner
20-
21-
# Make the binary accessible to docker-machine
22-
export GOPATH=$(go env GOPATH)
23-
export GOBIN=$GOPATH/bin
24-
export PATH="$PATH:$GOBIN"
16+
```shell
17+
# Download the binary (this example downloads the binary for linux amd64)
18+
$ wget https://github.com/JonasProgrammer/docker-machine-driver-hetzner/releases/download/0.2.4/docker-machine-driver-hetzner_0.2.4_linux_amd64.tar.gz
19+
$ tar -xvf docker-machine-driver-hetzner_0.2.4_linux_amd64.tar.gz
2520

21+
# Make it executable and copy the binary in a directory accessible with your $PATH
22+
$ chmod +x docker-machine-driver-hetzner
23+
$ cp docker-machine-driver-hetzner /usr/local/bin/
24+
```
2625

2726
## Usage
2827

2928
$ docker-machine create \
30-
--driver hetzner \
31-
--hetzner-api-token=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
32-
some-machine
29+
--driver hetzner \
30+
--hetzner-api-token=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
31+
some-machine
3332

3433
### Using environment variables
3534

3635
$ HETZNER_API_TOKEN=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
3736
&& HETZNER_IMAGE=centos-7 \
3837
&& docker-machine create \
39-
--driver hetzner \
40-
some-machine
38+
--driver hetzner \
39+
some-machine
4140

4241

4342
## Options
4443

45-
- `--hetzner-api-token`: **required**. Your project-specific access token for the Hetzner CLoud API.
44+
- `--hetzner-api-token`: **required**. Your project-specific access token for the Hetzner Cloud API.
4645
- `--hetzner-image`: The name of the Hetzner Cloud image to use, see [Images API](https://docs.hetzner.cloud/#resources-images-get) for how to get a list.
4746
- `--hetzner-server-type`: The type of the Hetzner Cloud server, see [Server Types API](https://docs.hetzner.cloud/#resources-server-types-get) for how to get a list.
4847
- `--hetzner-server-location`: The location to create the server in, see [Locations API](https://docs.hetzner.cloud/#resources-locations-get) for how to get a list.
@@ -81,28 +80,46 @@ was used during creation.
8180
| `--hetzner-existing-key-id` | `HETZNER_EXISTING_KEY_ID` | 0 *(upload new key)* |
8281

8382

83+
## Building from source
84+
85+
Use an up-to-date version of [Go](https://golang.org/dl)
86+
87+
To use the driver, you can download the sources and build it locally:
88+
89+
```shell
90+
# Get sources and build the binary at ~/go/bin/docker-machine-driver-hetzner
91+
$ go get github.com/jonasprogrammer/docker-machine-driver-hetzner
92+
93+
# Make the binary accessible to docker-machine
94+
$ export GOPATH=$(go env GOPATH)
95+
$ export GOBIN=$GOPATH/bin
96+
$ export PATH="$PATH:$GOBIN"
97+
```
98+
8499
## Development
85100

86101
Fork this repository, yielding `github.com/<yourAccount>/docker-machine-driver-hetzner`.
87102

88-
# Get the sources of your fork and build it locally
89-
go get github.com/<yourAccount>/docker-machine-driver-hetzner
90-
91-
# * This integrates your fork into the $GOPATH (typically pointing at ~/go)
92-
# * Your sources are at $GOPATH/src/github.com/<yourAccount>/docker-machine-driver-hetzner
93-
# * That folder is a local Git repository. You can pull, commit and push from there.
94-
# * The binary will typically be at $GOPATH/bin/docker-machine-driver-hetzner
95-
# * In the source directory $GOPATH/src/github.com/<yourAccount>/docker-machine-driver-hetzner
96-
# you may use go get to re-build the binary.
97-
# * Note: when you build the driver from different repositories, e.g. from your fork
98-
# as well as github.com/jonasprogrammer/docker-machine-driver-hetzner,
99-
# the binary files generated by these builds are all called the same
100-
# and will hence override each other.
101-
102-
# Make the binary accessible to docker-machine
103-
export GOPATH=$(go env GOPATH)
104-
export GOBIN=$GOPATH/bin
105-
export PATH="$PATH:$GOBIN"
106-
107-
# Make docker-machine output help including hetzner-specific options
108-
docker-machine create --driver hetzner
103+
```shell
104+
# Get the sources of your fork and build it locally
105+
$ go get github.com/<yourAccount>/docker-machine-driver-hetzner
106+
107+
# * This integrates your fork into the $GOPATH (typically pointing at ~/go)
108+
# * Your sources are at $GOPATH/src/github.com/<yourAccount>/docker-machine-driver-hetzner
109+
# * That folder is a local Git repository. You can pull, commit and push from there.
110+
# * The binary will typically be at $GOPATH/bin/docker-machine-driver-hetzner
111+
# * In the source directory $GOPATH/src/github.com/<yourAccount>/docker-machine-driver-hetzner
112+
# you may use go get to re-build the binary.
113+
# * Note: when you build the driver from different repositories, e.g. from your fork
114+
# as well as github.com/jonasprogrammer/docker-machine-driver-hetzner,
115+
# the binary files generated by these builds are all called the same
116+
# and will hence override each other.
117+
118+
# Make the binary accessible to docker-machine
119+
$ export GOPATH=$(go env GOPATH)
120+
$ export GOBIN=$GOPATH/bin
121+
$ export PATH="$PATH:$GOBIN"
122+
123+
# Make docker-machine output help including hetzner-specific options
124+
$ docker-machine create --driver hetzner
125+
```

0 commit comments

Comments
 (0)