Skip to content

Commit

Permalink
Adding package signing
Browse files Browse the repository at this point in the history
  • Loading branch information
jtyr committed Nov 19, 2017
1 parent f7418f1 commit 262576f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ matrix:

before_install:
- go get github.com/golang/lint/golint
- if [ -n "$TRAVIS_TAG" ]; then sudo apt-get install -y rpm build-essential fakeroot; fi
- if [ -n "$TRAVIS_TAG" ]; then sudo apt-get install -y rpm build-essential fakeroot expect; fi
- if [ -n "$TRAVIS_TAG" ]; then openssl aes-256-cbc -K $encrypted_6b7e08428daf_key -iv $encrypted_6b7e08428daf_iv -in dist/gpg_key.priv.enc -out dist/gpg_key.priv -d; fi

before_script:
- golint ./...
Expand Down
8 changes: 7 additions & 1 deletion dist/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ VER="${TRAVIS_TAG:1}"
TMP="/tmp/$NAME"
rm -fr "$TMP"

gpg --import "$TRAVIS_BUILD_DIR/dist/gpg_key.priv"
echo -e '%_gpg_name Jiri Tyr (PKG) <[email protected]>\n%dist .el7' > ~/.rpmmacros

for P in "${PLATFORMS[@]}"; do
echo "Building $P"

Expand All @@ -33,7 +36,7 @@ for P in "${PLATFORMS[@]}"; do
cd "$TRAVIS_BUILD_DIR/contrib"
ln -s "$PTMP" "$TRAVIS_BUILD_DIR/contrib/$NAME"
m4 -DVER="$VER" -DDATE="$(date '+%a, %d %b %Y %H:%M:%S %z')" debian/changelog.m4 > debian/changelog
dpkg-buildpackage -us -uc -tc -b
dpkg-buildpackage -tc -b -kCA67951CD2BBE8AAE4210B72FB90C91F64BED28C
)
mv "$TRAVIS_BUILD_DIR"/*.deb $TMP

Expand All @@ -45,6 +48,9 @@ for P in "${PLATFORMS[@]}"; do
m4 -DVER="$VER" -DDATE="$(date '+%a %b %d %Y')" gbt.spec.m4 > gbt.spec
rpmbuild -bb gbt.spec
)
echo -e '#!/usr/bin/expect -f\nspawn rpmsign --key-id CA67951CD2BBE8AAE4210B72FB90C91F64BED28C --addsign {*}$argv\nexpect -exact "Enter pass phrase: "\nsend -- "\\r"\nexpect eof' > ~/rpm-sign.exp
chmod +x ~/rpm-sign.exp
~/rpm-sign.exp ~/rpmbuild/RPMS/x86_64/*.rpm
mv ~/rpmbuild/RPMS/x86_64/*.rpm "$TMP"
fi
done
Expand Down
Binary file added dist/gpg_key.priv.enc
Binary file not shown.

0 comments on commit 262576f

Please sign in to comment.