diff --git a/.travis.yml b/.travis.yml index 89e505c..50eda9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -131,7 +131,9 @@ deploy: # - PROJECT_NAME: name of the project, set on the `env.global` above # - TRAVIS_TAG: tag name that the build is being deployed for, usually the version number # - TARGET: target triple of the build - file: $PROJECT_NAME-$TRAVIS_TAG-$TARGET.* + file: + - $PROJECT_NAME-$TRAVIS_TAG-$TARGET.* + - $PROJECT_NAME*.deb # don't delete artifacts from previous stage skip_cleanup: true on: diff --git a/ci/before_deploy.bash b/ci/before_deploy.bash index 1f33982..0c4f661 100755 --- a/ci/before_deploy.bash +++ b/ci/before_deploy.bash @@ -42,9 +42,77 @@ pack() { rm -r "$tempdir" } +make_deb() { + local tempdir + local architecture + local version + local dpkgname + local conflictname + + case $TARGET in + x86_64*) + architecture=amd64 + ;; + i686*) + architecture=i386 + ;; + *) + echo "ERROR: unknown target" >&2 + return 1 + ;; + esac + version=${TRAVIS_TAG#v} + if [[ $TARGET = *musl* ]]; then + dpkgname=$PACKAGE_NAME-musl + conflictname=$PACKAGE_NAME + else + dpkgname=$PACKAGE_NAME + conflictname=$PACKAGE_NAME-musl + fi + + tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp) + + # copy the main binary + install -Dm755 "target/$TARGET/release/build/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME" + strip "$tempdir/usr/bin/$PROJECT_NAME" + + # manpage + install -Dm644 "doc/$PROJECT_NAME.1" "$tempdir/usr/share/man/man1/$PROJECT_NAME.1" + + # readme and license + install -Dm644 README.md "$tempdir/usr/share/doc/$PACKAGE_NAME/README.md" + install -Dm644 LICENSE-MIT "$tempdir/usr/share/doc/$PACKAGE_NAME/LICENSE-MIT" + install -Dm644 LICENSE-APACHE "$tempdir/usr/share/doc/$PACKAGE_NAME/LICENSE-APACHE" + + # completions + install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/$PROJECT_NAME.bash_completion "$tempdir/usr/share/bash-completion/completions/$PROJECT_NAME.bash_completion" + install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/$PROJECT_NAME.fish "$tempdir/usr/share/fish/vendor_completions.d/$PROJECT_NAME.fish" + install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/_$PROJECT_NAME "$tempdir/usr/share/zsh/site-functions/_$PROJECT_NAME" + + # Control file + mkdir "$tempdir/DEBIAN" + cat > "$tempdir/DEBIAN/control" <