Fixed wrinkles in build script

master
Jef Roosens 2021-03-23 10:42:20 +01:00
parent cedcc3fc9f
commit ab94583e62
Signed by: Jef Roosens
GPG Key ID: B580B976584B5F30
3 changed files with 19 additions and 16 deletions

20
Cargo.lock generated
View File

@ -313,6 +313,16 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
] ]
[[package]]
name = "fej"
version = "0.0.1"
dependencies = [
"reqwest",
"rocket",
"rocket_contrib",
"serde",
]
[[package]] [[package]]
name = "filetime" name = "filetime"
version = "0.2.14" version = "0.2.14"
@ -1254,16 +1264,6 @@ dependencies = [
"unicode-xid 0.1.0", "unicode-xid 0.1.0",
] ]
[[package]]
name = "rust-api"
version = "0.1.0"
dependencies = [
"reqwest",
"rocket",
"rocket_contrib",
"serde",
]
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.2.3" version = "0.2.3"

View File

@ -1,6 +1,4 @@
IMAGE := chewingbever/fej IMAGE := chewingbever/fej
TAG := 0.0.1-dev
shell := /bin/bash
all: debug all: debug
@ -16,11 +14,11 @@ release:
.PHONY: release .PHONY: release
image: Dockerfile image: Dockerfile
@ bash ./build '$(IMAGE)' @ ./build '$(IMAGE)'
.PHONY: image .PHONY: image
push: push:
@ bash ./build '$(IMAGE)' push @ ./build '$(IMAGE)' push
.PHONY: push .PHONY: push
# Run # Run

9
build
View File

@ -15,7 +15,7 @@ minor_version="$(echo "$patch_version" |
branch="$(git branch --show-current)" branch="$(git branch --show-current)"
if [[ "$branch" = "master" ]]; then if [[ "$branch" = "master" ]]; then
tags=("$patch_version" "$minor_version" "$major_version" ) tags=("$patch_version" "$minor_version" "$major_version" "latest" )
elif [[ "$branch" = "develop" ]]; then elif [[ "$branch" = "develop" ]]; then
tags=("$patch_version-dev" "$minor_version-dev" "$major_version-dev" ) tags=("$patch_version-dev" "$minor_version-dev" "$major_version-dev" )
@ -28,7 +28,7 @@ fi
tag_flags=() tag_flags=()
for tag in "${tags[@]}"; do for tag in "${tags[@]}"; do
tag_flags+=("-t '$1:$tag'") tag_flags+=("-t $1:$tag")
done done
@ -36,6 +36,11 @@ done
docker build $tag_flags . docker build $tag_flags .
if [[ "$2" = push ]]; then if [[ "$2" = push ]]; then
[[ "$branch" =~ ^develop|master$ ]] || {
>&2 echo "You can only push from develop or master."
exit 2
}
for tag in "${tags[@]}"; do for tag in "${tags[@]}"; do
docker push "$1:$tag" docker push "$1:$tag"
done done