0install / docs

Zero Install documentation web-site
https://docs.0install.net
Creative Commons Attribution Share Alike 4.0 International
58 stars 8 forks source link

0install CI examples #19

Open bastianeicher opened 2 years ago

bastianeicher commented 2 years ago

Provide examples how to use 0install in CI scripts.

For example, placing a helper script named 0install.sh in your Git repo with:

#!/bin/sh
set -e

download() {
    zeroinstall_release=0install-$(uname | tr '[:upper:]' '[:lower:]')-$(uname -m)-${ZEROINSTALL_VERSION:-latest}
    download_dir=~/.cache/0install.net/$zeroinstall_release

    if [ ! -f $download_dir/files/0install ]; then
        echo "Downloading 0install..." >&2
        rm -rf $download_dir
        mkdir -p $download_dir
        curl -sSL https://get.0install.net/$zeroinstall_release.tar.bz2 | tar xj --strip-components 1 --directory $download_dir
    fi
}

if command -v 0install > /dev/null 2> /dev/null; then
    0install "$@"
else
    download
    $download_dir/files/0install "$@"
fi