Skip to content

Commit

Permalink
Merge pull request #744 from aptly-dev/nightly-builds
Browse files Browse the repository at this point in the history
Move release build to Travis CI
  • Loading branch information
smira committed Jun 11, 2018
2 parents 6a1c439 + b6fe160 commit 53c5572
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 20 deletions.
41 changes: 30 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ matrix:
env:
- RUN_LONG_TESTS=yes
- DEPLOY_BINARIES=yes
- APTLY_USER=aptly
- secure: "ejVss+Ansvk9f237iXVd87KA8N/SkfJkEdr/KCw9WRkVw3M9WyYtFnqpakIUPFT8RsSc7MW+RU4OM90DsbE9dbDIL0oW+t6QH/IfGjNG2HjDiGEWN/tMLeAQTtzPaVqlItJBo0ILMF2K6NrgkYBYU+tZ8gk5w7CuARvAk82d00o="
- go: master
env: RUN_LONG_TESTS=no

Expand All @@ -58,16 +60,33 @@ notifications:
on_start: false # default: false

before_deploy:
- make build
- export FILE_TO_UPLOAD=$(ls build/aptly-*)
- make release

deploy:
provider: releases
api_key:
- secure: "MMk5S1Im6RrVudZasjtlCJa/rvRp4oavrR86WI2kQszs1iZIcdGyVhHiOGfWTwMjA/3iPdbAdu/WrjxCwI14GC5ws+rs8ICO6JIZktjtAwlfwlrV+nsrCiYx1EThghq43VEcykgz2UAJoJj/egv+UCEpe8yDTsvJ6we5HiXdTw0="
file_glob: true
file: "${FILE_TO_UPLOAD}"
skip_cleanup: true
on:
tags: true
condition: "$DEPLOY_BINARIES = yes"
- provider: releases
api_key:
- secure: "MMk5S1Im6RrVudZasjtlCJa/rvRp4oavrR86WI2kQszs1iZIcdGyVhHiOGfWTwMjA/3iPdbAdu/WrjxCwI14GC5ws+rs8ICO6JIZktjtAwlfwlrV+nsrCiYx1EThghq43VEcykgz2UAJoJj/egv+UCEpe8yDTsvJ6we5HiXdTw0="
file_glob: true
file: build/*
skip_cleanup: true
on:
tags: true
condition: "$DEPLOY_BINARIES = yes"
- provider: s3
access_key_id:
secure: "I2etn22HHsQjJNhr6zdM/P4VLCYwEA/6HEf2eGvwey93oLeog+KnDCUI7lwGAHYuwzyDGQbZZ6YdoNc3b0kxaRWT0W+ke78TAdJhTZ+xbqGfEWv1er0zklJLOsimYF097rDJw8g3Oh/Gjwt5TTp0GJ5l3IhJ6zepNsKCMuwQpJM="
secret_access_key:
secure: "inRWX7FuyhkhKzGknSd2/mjZaNFZm/zHMejM99OF6PiGLNtyt/esdA0ToYL8B8Icl0/SISlLlEr/DDa4OGENKueFVeHrKH7OK0jVbWp9Yvw4hCXSlw9VmlkHDMQrC4gybS2Hf7el8N4AFVqyeUE7LqiP3WruHRdbE9XgOnTkLkg="
bucket: aptly-nightly
skip_cleanup: true
acl: public-read
local_dir: build
on:
branch: master
condition: "$DEPLOY_BINARIES = yes"
- provider: script
script: bash upload-artifacts.sh nightly
skip_cleanup: true
on:
branch: master
condition: "$DEPLOY_BINARIES = yes"
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ endif
install:
go install -v -ldflags "-X main.Version=$(VERSION)"

build:
rm -rf build
mkdir -p build
go build -v -ldflags "-X main.Version=$(VERSION)" -o "build/aptly-$(VERSION)"

system/env: system/requirements.txt
ifeq ($(RUN_LONG_TESTS), yes)
rm -rf system/env
Expand All @@ -66,19 +61,25 @@ mem.png: mem.dat mem.gp
gnuplot mem.gp
open mem.png

goxc:
goxc: dev
rm -rf root/
mkdir -p root/usr/share/man/man1/ root/etc/bash_completion.d/ root/usr/share/zsh/vendor-completions/
cp man/aptly.1 root/usr/share/man/man1
cp completion.d/aptly root/etc/bash_completion.d/
cp completion.d/_aptly root/usr/share/zsh/vendor-completions/
gzip root/usr/share/man/man1/aptly.1
goxc -pv=$(VERSION) -max-processors=4 $(GOXC_OPTS)
goxc -pv=$(VERSION) -max-processors=2 $(GOXC_OPTS)

release: GOXC_OPTS=-tasks-=bintray,go-vet,go-test,rmbin
release: goxc
rm -rf build/
mkdir -p build/
mv xc-out/$(VERSION)/aptly_$(VERSION)_* build/

man:
make -C man

version:
@echo $(VERSION)

.PHONY: man version build
.PHONY: man version release goxc
2 changes: 1 addition & 1 deletion aptly-api.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Documentation=https://www.aptly.info/doc/api/

[Service]
Type=simple
ExecStart=/usr/bin/aptly serve api -no-lock -listen=127.0.0.1:8081
ExecStart=/usr/bin/aptly api serve -no-lock -listen=127.0.0.1:8081

[Install]
WantedBy=multi-user.target
35 changes: 35 additions & 0 deletions upload-artifacts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

set -e

builds=build/
packages=${builds}*.deb
folder=`mktemp -u tmp.XXXXXXXXXXXXXXX`
aptly_user="$APTLY_USER"
aptly_password="$APTLY_PASSWORD"
aptly_api="https://internal.aptly.info"

for file in $packages; do
echo "Uploading $file..."
curl -sS -X POST -F "file=@$file" -u $aptly_user:$aptly_password ${aptly_api}/api/files/$folder
echo
done

if [[ "$1" = "nightly" ]]; then
aptly_repository=aptly-nightly
aptly_published=s3:repo.aptly.info:./nightly

echo "Adding packages to $aptly_repository..."
curl -sS -X POST -u $aptly_user:$aptly_password ${aptly_api}/api/repos/$aptly_repository/file/$folder
echo

echo "Updating published repo..."
curl -sS -X PUT -H 'Content-Type: application/json' --data \
'{"AcquireByHash": true, "Signing": {"Batch": true, "Keyring": "aptly.repo/aptly.pub",
"secretKeyring": "aptly.repo/aptly.sec", "PassphraseFile": "aptly.repo/passphrase"}}' \
-u $aptly_user:$aptly_password ${aptly_api}/api/publish/$aptly_published
echo
fi

curl -sS -X DELETE -u $aptly_user:$aptly_password ${aptly_api}/api/files/$folder
echo

0 comments on commit 53c5572

Please sign in to comment.