Skip to content

Commit

Permalink
add travis and goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
Jmainguy committed Nov 4, 2019
1 parent 8109865 commit d97d6ca
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 8 deletions.
42 changes: 42 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
env:
- GO111MODULE=on
before:
hooks:
# you may remove this if you don't use vgo
- 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
archives:
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
replacements:
linux: Linux
amd64: x86_64
nfpms:
- name_template: "{{ .ProjectName }}-{{ .Version }}.{{ .Arch }}"
replacements:
amd64: x86_64
homepage: https://soh.re
description: Update internet.bs for dynamic IP
maintainer: Jonathan Seth Mainguy <[email protected]>
license: GPLv2
vendor: Jmainguy
formats:
- deb
- rpm
checksum:
name_template: 'checksums.txt'
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
language: go
addons:
apt:
packages:
- rpm
env:
matrix:
- GO111MODULE="on"
global:
secure: omhuuoD7ZGl+7PZw/JXmkBCBvhI3ZJBp4Ez/MMvBnh/5a9FAUBh5LM2DMozhXjj3a21WWI2XgK82H38mMrUcWD0XLbNsfRgqg+GJggBi6PT+rF8qFLCvs2hVFsaD6JFF8UBtr6XzrNnVNCOGyquZnaZLAGasPBwou1X7V6Mq0LHtSxTumk4TsTNysc1J+6NQRirzNix9vc7NnQ6Pcz5O0IuccQ1nrcBmUTBTlNqX/jol3bNe8Gh9R88atlKIanYZNFQDnFC6OREWDLyRCQt5KiPeJ+KXnY03jQe9+GyH0YEJ3WVX4oVPNY50AwUfQ2LMIuVZaVjKcQ8GOW+bm7iKnSFxNpOXvJcIWjbiznAhXV1e4XZmdRjFNvYjLMUO+EDT+BpZtN2isvkoIdWTHZ8f+kxPcFXbGjWrnkr1+H2cddXY3T1G6D/hbbSMPFXaY722oKMOxr9EmRwdMtwApFLqI//gevZA8RScmy4kguzIIiVg80KoaDmBftxU1UkezM1fZgn8Pu0TKKAjR3G/5v36UhrZYUUCsGVZopjG/YW4pkx6aPZcRSLUkQPqOUIxwRJtfcagfHPfg8drEJGjchD7dx8py8OWSWic2WVp32FXwLjmmkEwUi4l2l5Guv/LebYMtARppuAfFqkYDG94QG5sSUzO6ikkqWexvMcN0nOb8QQ=
install:
after_success:
deploy:
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash
on:
tags: true
condition: "$TRAVIS_OS_NAME = linux"
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ On server at home (or where the IP will be dynamicly changing) you need to add `
On remotehost add ibsdns binary to `/usr/sbin/ibsdns` and edit `/opt/ibsdns/config.yaml` for your values.

Ensure passwordless ssh is setup from home to remote host, and that the user can read /opt/ibsdns/config.yaml

## Build
```/bin/bash
export GO111MODULE=on
go mod init
go build
```
8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module github.com/jmainguy/ibsdns

go 1.12

require (
github.com/ghodss/yaml v1.0.0
gopkg.in/yaml.v2 v2.2.4 // indirect
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
16 changes: 8 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main

import (
"flag"
"fmt"
"os"
"flag"
"os"
)

func check(e error) {
Expand All @@ -14,17 +14,17 @@ func check(e error) {

func main() {

value := flag.String("value", "", "IP to update domain to, example 192.168.1.1")
flag.Parse()
value := flag.String("value", "", "IP to update domain to, example 192.168.1.1")
flag.Parse()

c := config()
recordtype := "A"
newvalue := *value

if newvalue == "" {
fmt.Println("You must provide a value for the IP")
os.Exit(1)
}
if newvalue == "" {
fmt.Println("You must provide a value for the IP")
os.Exit(1)
}

tid, status, message := updateDns(c.ApiKey, c.Password, c.Domain, recordtype, newvalue)
if message != "" {
Expand Down

0 comments on commit d97d6ca

Please sign in to comment.