mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-25 10:20:18 -06:00
29 lines
895 B
Bash
Executable File
29 lines
895 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
PLATFORMS="linux/arm/v7,linux/arm64/v8,linux/amd64"
|
|
# PLATFORMS="linux/amd64"
|
|
DOCKER_IMAGE="shlinkio/shlink"
|
|
|
|
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
|
echo "Building version $GITHUB_REF"
|
|
|
|
# If ref is not develop, then this is a tag. Build that docker tag and also "stable"
|
|
if [[ "$GITHUB_REF" != *"develop"* ]]; then
|
|
TAGS="-t ${DOCKER_IMAGE}:${GITHUB_REF#?}"
|
|
# Push stable tag only if this is not an alpha or beta tag
|
|
[[ $GITHUB_REF != *"alpha"* && $GITHUB_REF != *"beta"* ]] && TAGS="${TAGS} -t ${DOCKER_IMAGE}:stable"
|
|
|
|
docker buildx build --push \
|
|
--build-arg SHLINK_VERSION=${GITHUB_REF#?} \
|
|
--platform ${PLATFORMS} \
|
|
${TAGS} .
|
|
|
|
# If build branch is develop, build latest
|
|
elif [[ "$GITHUB_REF" == *"develop"* ]]; then
|
|
docker buildx build --push \
|
|
--platform ${PLATFORMS} \
|
|
-t ${DOCKER_IMAGE}:latest .
|
|
fi
|