Files
docker-mods-uptime-kuma-tim…/.travis.yml
T
2020-10-15 14:09:40 -04:00

42 lines
1.9 KiB
YAML

os: linux
language: shell
branches:
only:
- code-server-dotnet
services:
- docker
env:
global:
- DOCKERHUB="linuxserver/mods"
- BASEIMAGE="code-server"
- MODNAME="dotnet"
jobs:
include:
- stage: PR-BuildImage
if: (type IN (pull_request))
script:
# Build image
- DOTNET_JSON="$(curl --retry 5 -sX GET https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json)"
- DOTNET_VERSIONS="$(echo $DOTNET_JSON | jq -r '."releases-index"[] | select(."support-phase"=="lts") | ."latest-sdk"' | tr '\n' ' ' | head -c -1)"
- docker build --no-cache --build-arg DOTNET_VERSIONS="${DOTNET_VERSIONS}" -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} .
- stage: BuildImage
if: (NOT (type IN (pull_request)))
script:
# Build image
- DOTNET_JSON="$(curl --retry 5 -sX GET https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json)"
- DOTNET_VERSIONS="$(echo $DOTNET_JSON | jq -r '."releases-index"[] | select(."support-phase"=="lts") | ."latest-sdk"' | tr '\n' ' ' | head -c -1)"
- DOTNET_TAG="$(echo $DOTNET_VERSIONS | tr ' ' '_')"
- docker build --no-cache --build-arg DOTNET_VERSIONS="${DOTNET_VERSIONS}" -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} .
- docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}
- docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${DOTNET_TAG}
# Login to DockerHub
- echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin
# Push all of the tags
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT}
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${DOTNET_TAG}