2
0
mirror of https://github.com/spritsail/plex-media-server.git synced 2024-11-05 01:16:23 +00:00
plex-media-server/.drone.yml

51 lines
1.9 KiB
YAML

pipeline:
identify:
image: docker
commands:
# Grab the current version, prevents race conditions
#### Pass this into the Dockerfile somehow?
- apk add --no-cache openssl jq
- wget -qO- https://adam-ant.co.uk/plex/pass-version.php | tee /dev/stderr | jq -r .release > .plex_version
build:
image: docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock
commands:
- docker build --no-cache --pull -t ppass-dev .
test:
image: docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock
commands:
- apk add --no-cache curl xmlstarlet grep
- export CUR_VERSION="$(cat .plex_version)"
- CON_NAME=$(docker run --rm -d ppass-dev)
- sleep 25 # Wait for plex to start!
- docker logs $$CON_NAME
- curl -sSL $(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $$CON_NAME):32400/identity \
| tee /dev/stderr \
| xmlstarlet sel -t -v "/MediaContainer/@version" \
| grep -qw $CUR_VERSION
- docker kill $$CON_NAME # Not really needed, but keeps things quick
publish:
image: docker
when:
event: [push, tag, deployment]
secrets: [ DOCKER_USER, DOCKER_PASS ]
volumes:
- /var/run/docker.sock:/var/run/docker.sock
commands:
# Grab just the version, not the hash. Used for tagging
- export CUR_VERSION=$(cat .plex_version | cut -d \- -f1 )
- echo $CUR_VERSION
- echo $DOCKER_USER
- docker tag ppass-dev adamant/plexmediaserver:plexpass
- docker tag ppass-dev adamant/plexmediaserver:plexpass-$CUR_VERSION
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- docker push adamant/plexmediaserver
- docker rmi adamant/plexmediaserver:plexpass adamant/plexmediaserver:plexpass-$CUR_VERSION ppass-dev
- echo "CONGRATS! SUCCESSFULLY BUILT PLEX VERSION $CUR_VERSION-PASS"