Merge pull request #35 from davidnewhall/dn2_fix_deploy

Get homebrew Formula to upload
This commit is contained in:
David Newhall II 2019-06-12 19:14:50 -07:00 committed by GitHub
commit 677048db19
6 changed files with 59 additions and 17 deletions

View File

@ -10,11 +10,6 @@ go:
- 1.12.x
before_install:
- mkdir -p $GOPATH/bin
# This deploy key is not used atm.
- openssl aes-256-cbc -K $encrypted_9f3147001275_key -iv $encrypted_9f3147001275_iv -in .github_deploy_key.enc -out github_deploy_key -d
- chmod 600 github_deploy_key
- eval $(ssh-agent -s)
- ssh-add github_deploy_key
# Download the `dep` binary to bin folder in $GOPATH
- curl -sLo $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.3/dep-darwin-amd64
- chmod +x $GOPATH/bin/dep
@ -25,6 +20,18 @@ install:
- rvm $brew_ruby do gem install --no-document fpm
script:
- rvm $brew_ruby do make release
# get deploy key for golift/homebrew-repo.
after_success:
- |
declare -r SSH_FILE="$(mktemp -u $HOME/.ssh/XXXXX)"
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
openssl aes-256-cbc -K $encrypted_9f3147001275_key -iv $encrypted_9f3147001275_iv -in ".travis/github_deploy_key.enc" -out "$SSH_FILE" -d
chmod 600 "$SSH_FILE" \
&& printf "%s\n" \
"Host github.com" \
" IdentityFile $SSH_FILE" \
" StrictHostKeyChecking no" \
" LogLevel ERROR" >> ~/.ssh/config
deploy:
- provider: releases
api_key:
@ -37,8 +44,11 @@ deploy:
repo: davidnewhall/unifi-poller
tags: true
- provider: script
script: scripts/formula-deploy.sh ${TRAVIS_TAG}
script: scripts/formula-deploy.sh
on:
repo: davidnewhall/unifi-poller
tags: true
secure: "0yBdTabuF8LM8nQ8hSF1wjigQawal9N/v2NlR62oioMvzqWOy0zKo8R+mcfHK+pCByx0Ki/VWslms/WBKQnQvolGKY32UOg2cJvoVMoOemcwaezLK0kGZt8+O83ZQLr0CsiuzLQxJoqjiYf8ca6N2tjDFIowLPzSNPQR32mAP8cTe5fkxKyFAXgmA41BkzWMTx/V9R6udcX+Oofi8tpIZv1fyqSMNVlItHLxLFeP7F/r6OSM/Y87abAOt1U/ugPDufCL1MpmjRNhkL+NnHajSI30RsHFMv0c96hV3Va2g1VXrEVTB3F/0HhwBd9vwWwmiAGDMP/Nh7WfkQjHgHYCWVlbYgEdZj3rxeP9p14WEki3VavW2tZENjXoHpJswcT3UhB2m49p+pyV9NbzxZKeJDa2oniYBA9RfCrIURUIDI9Mk7vb+SVdcwx8JioiOebo568eRNHFI66KmQFrCGs+ZSuGFMk2ftaqhHSSctaD14EXzIurmWernw8xwmJAyiyBx6bKUIF969lBPlLVVCbl86ekNjm5xPxCaUM+Evugzo6nGsGckEUor85Ej54Q8qcxO/3m12F6gbHaEUUVK1splk+3dvDrSTZ6zJ+opxKkFph1MLjqQOIwqGU6DMMKy0JxMusjRg8n135LQQ/V05+Mzci4AF+kctidKfE42JDt5vA="
repo: davidnewhall/unifi-poller
env:
global:
- GH_USER_NAME=unifi-auto-releaser
- GH_USER_EMAIL=unifi@auto.releaser

Binary file not shown.

View File

@ -179,13 +179,14 @@ install: man readme $(BINARY)
@echo - Otherwise, build and install a package: make rpm -or- make deb
@echo See the Package Install wiki for more info: $(URL)/wiki/Package-Install
@[ "$$(uname)" = "Darwin" ] || (echo "Unable to continue, not a Mac." && false)
@[ "$(PREFIX)" != "" ] || (echo "Unable to continue, PREFIX not set. Use: make install PREFIX=/usr/local" && false)
@[ "$(PREFIX)" != "" ] || (echo "Unable to continue, PREFIX not set. Use: make install PREFIX=/usr/local ETC=/usr/local/etc" && false)
@[ "$(ETC)" != "" ] || (echo "Unable to continue, ETC not set. Use: make install PREFIX=/usr/local ETC=/usr/local/etc" && false)
# Copying the binary, config file, unit file, and man page into the env.
/usr/bin/install -m 0755 -d $(PREFIX)/bin $(PREFIX)/share/man/man1 $(PREFIX)/etc/$(BINARY) $(PREFIX)/share/doc/$(BINARY)/examples
/usr/bin/install -m 0755 -d $(PREFIX)/bin $(PREFIX)/share/man/man1 $(ETC)/$(BINARY) $(PREFIX)/share/doc/$(BINARY)/examples
/usr/bin/install -m 0755 -cp $(BINARY) $(PREFIX)/bin/$(BINARY)
/usr/bin/install -m 0644 -cp $(BINARY).1.gz $(PREFIX)/share/man/man1
/usr/bin/install -m 0644 -cp examples/up.conf.example $(PREFIX)/etc/$(BINARY)/
[ -f $(PREFIX)/etc/$(BINARY)/up.conf ] || /usr/bin/install -m 0644 -cp examples/up.conf.example $(PREFIX)/etc/$(BINARY)/up.conf
/usr/bin/install -m 0644 -cp examples/up.conf.example $(ETC)/$(BINARY)/
[ -f $(ETC)/$(BINARY)/up.conf ] || /usr/bin/install -m 0644 -cp examples/up.conf.example $(ETC)/$(BINARY)/up.conf
/usr/bin/install -m 0644 -cp *.html examples/{*dash.json,up.conf.example} $(PREFIX)/share/doc/$(BINARY)/
# These go to their own folder so the img src in the html pages continue to work.
/usr/bin/install -m 0644 -cp examples/*.png $(PREFIX)/share/doc/$(BINARY)/examples

View File

@ -5,11 +5,10 @@
make unifi-poller.rb
VERSION=$(grep -E '^\s*version\s*"' unifi-poller.rb | cut -d\" -f 2)
git config user.name "unifi-poller-bot"
git config user.email "unifi@poller.bot"
rm -rf homebrew-repo
git clone https://$GITHUB_API_KEY@github.com/golift/homebrew-repo.git
git config --global user.email "unifi@auto.releaser"
git config --global user.name "unifi-auto-releaser"
git clone git@github.com:golift/homebrew-repo.git
cp unifi-poller.rb homebrew-repo/Formula
pushd homebrew-repo

View File

@ -21,10 +21,42 @@ class UnifiPoller < Formula
bin_path.install Dir["*"]
cd bin_path do
system "dep", "ensure"
system "make", "install", "VERSION=#{version}", "PREFIX=#{prefix}"
system "make", "install", "VERSION=#{version}", "PREFIX=#{prefix}", "ETC=#{etc}"
end
end
plist_options :startup => true
def plist; <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{bin}/unifi-poller</string>
<string>-c</string>
<string>#{etc}/unifi-poller/up.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>#{var}/log/unifi-poller/log</string>
<key>StandardOutPath</key>
<string>#{var}/log/unifi-poller/log</string>
<key>UserName</key>
<string>nobody</string>
<key>GroupName</key>
<string>nobody</string>
</dict>
</plist>
EOS
end
test do
assert_match "unifi-poller v#{version}", shell_output("#{bin}/unifi-poller -v 2>&1", 2)
end