diff --git a/.gitignore b/.gitignore index d806a068..58ce83d5 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ README.html /unifi-poller_manual.html /homebrew_release_repo /.metadata.make +bitly_token +github_deploy_key +.secret_files.tar diff --git a/.metadata.sh b/.metadata.sh index bc4a04c8..b0c2a17d 100755 --- a/.metadata.sh +++ b/.metadata.sh @@ -1,5 +1,6 @@ # Each line must have an export clause. # This file is parsed and sourced by the Makefile, Docker and Homebrew builds. +# Powered by Application Builder: https://github.com/golift/application-builder # Must match the repo name. BINARY="unifi-poller" @@ -33,7 +34,8 @@ URL="https://github.com/${GHREPO}" VERSION_PATH="github.com/${GHREPO}/$(echo ${BINARY} | tr -d -- -).Version" # Dynamic. Recommend not changing. -VERSION="$(git tag -l --merged | tail -n1 | tr -d v | grep -E '^\S+$' || echo development)" +VVERSION=$(git describe --abbrev=0 --tags $(git rev-list --tags --max-count=1)) +VERSION="$(echo $VVERSION | tr -d v | grep -E '^\S+$' || echo development)" # This produces a 0 in some envirnoments (like Homebrew), but it's only used for packages. ITERATION=$(git rev-list --count --all || echo 0) DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" diff --git a/.travis.yml b/.travis.yml index f8ec6b19..93f12d69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +# Powered by Application Builder: https://github.com/golift/application-builder language: go git: depth: false diff --git a/Makefile b/Makefile index c6a82e75..e0bbfd43 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -# This# This Makefile is written as generic as possible. +# This Makefile is written as generic as possible. # Setting the variables in .metadata.sh and creating the paths in the repo makes this work. -# +# See more: https://github.com/golift/application-builder # Suck in our application information. IGNORED:=$(shell bash -c "source .metadata.sh ; env | sed 's/=/:=/;s/^/export /' > .metadata.make") diff --git a/README.md b/README.md index 6fae649e..8a2a3d90 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ [![pulls](https://badgen.net/docker/pulls/golift/unifi-poller?icon=docker&label=pulls&color=0066ff "Docker Pulls")](https://hub.docker.com/r/golift/unifi-poller) [![DLs](https://img.shields.io/github/downloads/davidnewhall/unifi-poller/total.svg?logo=github&color=0066ff "GitHub Downloads")](https://www.somsubhra.com/github-release-stats/?username=davidnewhall&repository=unifi-poller) -![stars](https://badgen.net/github/stars/davidnewhall/unifi-poller?icon=github&label=stars&color=0066ff "GitHub Stars") -![unifi](https://badgen.net/badge/UniFi/5.10.x,5.11.x,UAP,USG,USW?list=|&icon=&color=0099ee "UniFi") +[![stars](https://badgen.net/github/stars/davidnewhall/unifi-poller?icon=github&label=stars&color=0066ff "GitHub Stars")](https://github.com/davidnewhall/unifi-poller) +[![unifi](https://badgen.net/badge/UniFi/5.10.x,5.11.x,UAP,USG,USW?list=|&icon=&color=0099ee "UniFi")](https://github.com/golift/unifi) [![issues](https://badgen.net/github/closed-issues/davidnewhall/unifi-poller?color=green&icon=github "Closed Issues")](https://github.com/davidnewhall/unifi-poller/issues?q=is%3Aissue+is%3Aclosed) [![PRs](https://badgen.net/github/prs/davidnewhall/unifi-poller?icon=github&color=green "Pull Requests")](https://github.com/davidnewhall/unifi-poller/pulls?utf8=✓&q=is%3Apr+) diff --git a/init/docker/Dockerfile b/init/docker/Dockerfile index b1f14ad4..57eeb331 100644 --- a/init/docker/Dockerfile +++ b/init/docker/Dockerfile @@ -1,5 +1,6 @@ # -# building static go binary with Debian golang container +# This is part of Application Builder. +# https://github.com/golift/application-builder # ARG ARCH=amd64 @@ -45,7 +46,7 @@ ARG CONFIG_FILE=config.conf # Build-time metadata as defined at https://github.com/opencontainers/image-spec/blob/master/annotations.md LABEL org.opencontainers.image.created="${BUILD_DATE}" \ org.opencontainers.image.title="${BINARY}" \ - org.opencontainers.image.documentation="${URL}/wiki/Docker" \ + org.opencontainers.image.documentation="https://github.com/${GHREPO}/wiki/Docker" \ org.opencontainers.image.description="${DESC}" \ org.opencontainers.image.url="${URL}" \ org.opencontainers.image.revision="${COMMIT}" \ diff --git a/init/docker/hooks/README.md b/init/docker/hooks/README.md index 1646737c..29d4d4f1 100644 --- a/init/docker/hooks/README.md +++ b/init/docker/hooks/README.md @@ -1,15 +1,23 @@ -# Docker Build Hooks +# Application Builder + +[https://github.com/golift/application-builder](https://github.com/golift/application-builder) + +## Docker Build Hooks The files in this folder are used by Docker Cloud to automate image builds. +Do not edit these files. If you want to build, maintain and push multi-architecture Docker images, you may follow the example provided here. All of the hooks are generic, and will work with any build. Two environment variables must be passed in from Docker Cloud config. -`BUILDS` must be set to the builds you're trying to perform. This repo is currently -set to `linux:armhf:arm: linux:arm64:arm64:armv8 linux:amd64:amd64: linux:i386:386:`. -The format is `os:name:arch:variant`. `os` and `name` are passed into the Dockerfile. -`os`, `arch` and `variant` are passed into `docker manifest annotate`. This does not -yet work with an OS other than `linux`. + +1. `BUILDS` must be set to the builds you're trying to perform. This repo is currently set to: + - `linux:armhf:arm: linux:arm64:arm64:armv8 linux:amd64:amd64: linux:i386:386:` + - The format is `os:name:arch:variant`. + - `os` and `name` are passed into the Dockerfile. + - `os`, `arch` and `variant` are passed into `docker manifest annotate`. + - This does not yet work with an OS other than `linux`. +1. Set `DOCKER_CLI_EXPERIMENTAL` to `enabled`. Not optional. Keep the build simple; see screenshot. This only supports one build tag, but it creates many more. diff --git a/init/docker/hooks/build b/init/docker/hooks/build index 01be1ca9..051c164b 100755 --- a/init/docker/hooks/build +++ b/init/docker/hooks/build @@ -1,6 +1,8 @@ #!/bin/bash # The Docker Cloud config must pass in the BUILDS env variable. # See README.md (in this dir) and the screenshot for more info. +# This is part of Application Builder. +# https://github.com/golift/application-builder set -e -o pipefail diff --git a/init/docker/hooks/pre_build b/init/docker/hooks/pre_build index c072eb70..e77de974 100755 --- a/init/docker/hooks/pre_build +++ b/init/docker/hooks/pre_build @@ -1,4 +1,6 @@ #!/bin/bash +# This is part of Application Builder. +# https://github.com/golift/application-builder # https://www.smockle.com/blog/2019/04/22/migrating-from-travis-ci-to-docker-hub-automated-builds/ diff --git a/init/docker/hooks/push b/init/docker/hooks/push index f49206ee..b4c52546 100755 --- a/init/docker/hooks/push +++ b/init/docker/hooks/push @@ -1,6 +1,8 @@ #!/bin/bash # This post build hook creates multi-architecture docker manifests. # It's all a bit complicated for some reason. +# This is part of Application Builder. +# https://github.com/golift/application-builder set -e -o pipefail diff --git a/init/homebrew/service.rb.tmpl b/init/homebrew/service.rb.tmpl index c9731742..85427ebc 100644 --- a/init/homebrew/service.rb.tmpl +++ b/init/homebrew/service.rb.tmpl @@ -1,4 +1,6 @@ # Homebrew Formula Template. Built by Makefile: `make fomula` +# This is part of Application Builder. +# https://github.com/golift/application-builder class {{Class}} < Formula desc "{{Desc}}" homepage "{{URL}}" diff --git a/init/systemd/template.unit.service b/init/systemd/template.unit.service index 468669be..d09fd9a9 100644 --- a/init/systemd/template.unit.service +++ b/init/systemd/template.unit.service @@ -1,4 +1,6 @@ # Systemd service unit for {{BINARY}}. +# This is part of Application Builder. +# https://github.com/golift/application-builder [Unit] Description={{BINARY}} - {{DESC}} diff --git a/scripts/formula-deploy.sh b/scripts/formula-deploy.sh index 80d7ebd5..a99b6521 100755 --- a/scripts/formula-deploy.sh +++ b/scripts/formula-deploy.sh @@ -1,9 +1,10 @@ #!/bin/bash -x -# Deploys a new homebrew formula file to golift/homebrew-tap. +# Deploys a new homebrew formula file to a github homebrew formula repo: $HBREPO # Requires SSH credentials in ssh-agent to work. # Run by Travis-CI when a new release is created on GitHub. -# Do not edit this file. +# Do not edit this file. It's part of application-builder. +# https://github.com/golift/application-builder source .metadata.sh diff --git a/scripts/install.sh b/scripts/install.sh index caea43a6..4ad62388 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -8,6 +8,8 @@ # === # If you're on redhat, this installs the latest rpm. If you're on Debian, it installs the latest deb package. # +# This is part of application-builder. +# https://github.com/golift/application-builder REPO=davidnewhall/unifi-poller LATEST=https://api.github.com/repos/${REPO}/releases/latest