build 781 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. set -ex
  3. PLATFORMS="linux/arm/v7,linux/arm64/v8,linux/amd64"
  4. DOCKER_IMAGE="shlinkio/shlink"
  5. # If ref is not develop, then this is a tag. Build that docker tag and also "stable"
  6. if [[ "$GITHUB_REF" != *"develop"* ]]; then
  7. VERSION=${GITHUB_REF#refs/tags/v}
  8. TAGS="-t ${DOCKER_IMAGE}:${VERSION}"
  9. # Push stable tag only if this is not an alpha or beta tag
  10. [[ $GITHUB_REF != *"alpha"* && $GITHUB_REF != *"beta"* ]] && TAGS="${TAGS} -t ${DOCKER_IMAGE}:stable"
  11. docker buildx build --push \
  12. --build-arg SHLINK_VERSION=${VERSION} \
  13. --platform ${PLATFORMS} \
  14. ${TAGS} .
  15. # If build branch is develop, build latest
  16. elif [[ "$GITHUB_REF" == *"develop"* ]]; then
  17. docker buildx build --push \
  18. --platform ${PLATFORMS} \
  19. -t ${DOCKER_IMAGE}:latest .
  20. fi