diff --git a/.build.yml b/.build.yml index 6fbcfc4..fc51990 100644 --- a/.build.yml +++ b/.build.yml @@ -2,6 +2,7 @@ image: ubuntu/focal secrets: - 31c0c342-c396-4190-9637-1c3cedd705a5 # SSH key + - 4e6bb736-559c-4b3e-ba04-331f5808cacc # aptrepo SSH key (to upload the build result to apt.playfulpachyderm.com) - 8803f94a-8b8b-4966-aac7-4b8e24c328ce # Gitlab access token - c84e3f2c-7c97-4cef-859e-8b13de32a7be # ~/.ssh/known_hosts (gitlab.com) @@ -69,3 +70,30 @@ tasks: duration=$SECONDS echo "Task completed in $(($duration / 60))m$(($duration % 60))s." + + - dpkg_build: | + version=$(git rev-parse --abbrev HEAD | grep -Poh "(?<=release-)\d+\.\d+\.\d+") + + if [[ -z "$version" ]] + then + # Not on a release branch; just exit this task + exit + fi + + SECONDS=0 + + cd twitter_offline_engine/build + ./build_dpkg.sh $version + + duration=$SECONDS + echo "Task completed in $(($duration / 60))m$(($duration % 60))s." + + - upload_dpkg: | + # Just fail + test -z "fjkjksdf" + + + # SECONDS=0 + + # cd twitter_offline_engine/build + # scp offline diff --git a/build/.gitignore b/build/.gitignore new file mode 100644 index 0000000..7fd5ade --- /dev/null +++ b/build/.gitignore @@ -0,0 +1,2 @@ +dpkg_tmp +*.deb diff --git a/build/build_dpkg.sh b/build/build_dpkg.sh new file mode 100755 index 0000000..e682e3f --- /dev/null +++ b/build/build_dpkg.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -e + +if [[ -z "$1" ]] +then + # Error message and exit + >&2 echo "No version number provided! Exiting." + exit 1 +fi + +# Compile the program +(cd ../cmd && ./compile.sh) + +# Prepare the output folder +if [[ -e dpkg_tmp ]] +then + rm -rf dpkg_tmp +fi +mkdir dpkg_tmp + +# Construct the dpkg directory structure +mkdir -p dpkg_tmp/usr/local/bin +cp ../cmd/tw dpkg_tmp/usr/local/bin + +# Create the `DEBIAN/control` file +mkdir dpkg_tmp/DEBIAN +echo "Package: offline-twitter-engine +Version: $1 +Architecture: all +Maintainer: me@playfulpachyderm.com +Installed-Size: 7200 +Depends: +Section: web +Priority: optional +Homepage: http://offline-twitter.com +Description: This utility is the scraper engine that drives \`offline-twitter\`. + Download and browse content from twitter. + Save a local copy of everything you browse. +" > dpkg_tmp/DEBIAN/control + + +dpkg-deb --build `pwd`/dpkg_tmp .