Fixed strange dc behavior

master^2
Jef Roosens 2021-04-17 17:46:16 +02:00
parent 43e26191cc
commit 95f45cab76
Signed by: Jef Roosens
GPG Key ID: 955C0660072F691F
1 changed files with 10 additions and 7 deletions

17
fejctl
View File

@ -8,7 +8,10 @@ image='chewingbever/fej'
# -b: build the builder
# -r: use the release image instead
function dc() {
local OPTIND c build_builder release
while getopts ":br" c; do
echo "$c"
case $c in
b ) build_builder=1 ;;
r ) release=1 ;;
@ -52,7 +55,7 @@ function dcr() {
# Tags & pushes the release version to Docker Hub
function publish() {
branch=`git rev-parse --abbrev-ref HEAD`
local branch=`git rev-parse --abbrev-ref HEAD`
if [[ "$branch" != master ]]; then
>&2 echo "You can only publish from master."
@ -62,10 +65,10 @@ function publish() {
# Build the release images
dc -br build
patch_version=`grep -Po '(?<=version = ").*(?=")' Cargo.toml | head -n1`
major_version=`echo "$patch_version" | sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/'`
minor_version=`echo "$patch_version" | sed -E 's/([0-9]+).([0-9]+).([0-9]+)/\1.\2/'`
tags=("latest" "$patch_version" "$minor_version" "$major_version")
local patch_version=`grep -Po '(?<=version = ").*(?=")' Cargo.toml | head -n1`
local major_version=`echo "$patch_version" | sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/'`
local minor_version=`echo "$patch_version" | sed -E 's/([0-9]+).([0-9]+).([0-9]+)/\1.\2/'`
local tags=("latest" "$patch_version" "$minor_version" "$major_version")
for tag in "${tags[@]}"; do
# Create the tag
@ -86,8 +89,8 @@ function publish() {
# $2: binary to use, defaults to 'server'
function main() {
# Default values
cmd="${1:-build}"
bin="${2:-server}"
local cmd="${1:-build}"
local bin="${2:-server}"
case $cmd in
# Building