feature: nightly and dev images #5
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: default
|
name: production
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
@ -45,6 +45,7 @@ steps:
|
|||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
repo: fbrinker/tileboard
|
repo: fbrinker/tileboard
|
||||||
|
dockerfile: Dockerfile
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
password:
|
password:
|
||||||
|
37
build.sh
37
build.sh
@ -1,36 +1,40 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
getVersionFromLatestRelease() {
|
getVersionFromLatestRelease() {
|
||||||
version=`curl -s "https://api.github.com/repos/resoai/TileBoard/releases/latest" \
|
repo="${1-resoai/TileBoard}"
|
||||||
|
version=`curl -s "https://api.github.com/repos/$repo/releases/latest" \
|
||||||
| grep "tag_name" \
|
| grep "tag_name" \
|
||||||
| cut -d '"' -f 4 \
|
| cut -d '"' -f 4 \
|
||||||
| sed -e "s/v//"`
|
| sed -e "s/v//"`
|
||||||
|
|
||||||
echo "$version"
|
echo "$version"
|
||||||
}
|
}
|
||||||
|
|
||||||
getDownloadUrl() {
|
getDownloadUrl() {
|
||||||
url=`curl -s "https://api.github.com/repos/resoai/TileBoard/releases/latest" \
|
repo="${1-resoai/TileBoard}"
|
||||||
|
url=`curl -s "https://api.github.com/repos/$repo/releases/latest" \
|
||||||
| grep "browser_download_url" \
|
| grep "browser_download_url" \
|
||||||
| cut -d '"' -f 4`
|
| cut -d '"' -f 4`
|
||||||
|
|
||||||
echo "$url"
|
echo "$url"
|
||||||
}
|
}
|
||||||
|
|
||||||
getLatestPublishedTag() {
|
docker_tag_exists() {
|
||||||
latest_tag=`curl -s "https://hub.docker.com/v2/repositories/fbrinker/tileboard/tags?page_size=1" \
|
repo="${1-fbrinker/tileboard}"
|
||||||
| jq -r ".results[0].name"`
|
tag="${2-latest}"
|
||||||
|
curl --silent -f -lSL "https://hub.docker.com/v2/repositories/$repo/tags/$tag" > /dev/null 2>&1
|
||||||
echo "$latest_tag"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LATEST_RELEASE=`getVersionFromLatestRelease`
|
source_repo="${1-resoai/TileBoard}"
|
||||||
LATEST_TAG=`getLatestPublishedTag`
|
docker_repo="${2-fbrinker/tileboard}"
|
||||||
|
echo "Source repository: $source_repo."
|
||||||
|
echo "Docker repository: $docker_repo."
|
||||||
|
|
||||||
if [ "$LATEST_RELEASE" = "$LATEST_TAG" ]; then
|
LATEST_RELEASE=`getVersionFromLatestRelease $source_repo`
|
||||||
echo "Nothing to do. Versions already match."
|
echo "Latest release is: $LATEST_RELEASE."
|
||||||
echo "Release: $LATEST_RELEASE"
|
|
||||||
echo "Tag: $LATEST_TAG"
|
if docker_tag_exists $docker_repo $LATEST_RELEASE; then
|
||||||
|
echo "Nothing to do. Latest release tag already exists."
|
||||||
exit 78 # drone.io exit code to stop but success the pipeline
|
exit 78 # drone.io exit code to stop but success the pipeline
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -42,6 +46,7 @@ PATCH=$LATEST_RELEASE
|
|||||||
echo "latest,$MAJOR,$MINOR,$PATCH" > .tags
|
echo "latest,$MAJOR,$MINOR,$PATCH" > .tags
|
||||||
|
|
||||||
RELEASE_URL=`getDownloadUrl`
|
RELEASE_URL=`getDownloadUrl`
|
||||||
|
echo "URL of release is: $RELEASE_URL."
|
||||||
|
|
||||||
echo "Writing $RELEASE_URL into Dockerfile..."
|
echo "Writing release URL into Dockerfile..."
|
||||||
sed -i "s|%RELEASE_URL%|$RELEASE_URL|g" ./Dockerfile
|
sed -i "s|%RELEASE_URL%|$RELEASE_URL|g" ./Dockerfile
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren