Move ci scripts to bash functions