2020-03-10 09:07:50 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
### ---- ###
|
|
|
|
|
|
|
|
echo "Switch back to master"
|
|
|
|
git checkout master
|
|
|
|
git reset --hard origin/master
|
|
|
|
|
|
|
|
### ---- ###
|
|
|
|
|
|
|
|
version=$(curl -s "https://lv.luzifer.io/catalog-api/openfire/latest.txt?p=version")
|
|
|
|
versionVar=$(echo "${version}" | sed 's/\./_/g')
|
2020-03-13 11:45:38 +00:00
|
|
|
grep -q "OPENFIRE_VERSION=${versionVar}" Dockerfile && exit 0 || echo "Update required"
|
2020-03-10 09:07:50 +00:00
|
|
|
|
|
|
|
sed -Ei \
|
|
|
|
-e "s/OPENFIRE_VERSION=[0-9_]+/OPENFIRE_VERSION=${versionVar}/" \
|
|
|
|
Dockerfile
|
|
|
|
|
|
|
|
### ---- ###
|
|
|
|
|
|
|
|
echo "Testing image build and run..."
|
|
|
|
|
|
|
|
function cleanup() {
|
|
|
|
docker rm -f luzifer-openfire
|
|
|
|
}
|
|
|
|
|
|
|
|
docker run -d --name luzifer-openfire $(docker build -q .)
|
|
|
|
trap cleanup EXIT
|
|
|
|
|
|
|
|
sleep 5 # Container needs a moment to spin up
|
2021-04-23 09:34:16 +00:00
|
|
|
docker exec -i luzifer-openfire sh -exc 'apk --no-cache add curl && curl -sL localhost:9090/index.jsp | grep -q "Openfire Setup"'
|
2020-03-10 09:07:50 +00:00
|
|
|
|
|
|
|
### ---- ###
|
|
|
|
|
|
|
|
echo "Updating repository..."
|
|
|
|
git add Dockerfile
|
|
|
|
git -c user.name='Travis Automated Update' -c user.email='travis@luzifer.io' \
|
|
|
|
commit -m "Openfire ${version}"
|
|
|
|
git tag ${version}
|
|
|
|
|
|
|
|
git push -q https://${GH_USER}:${GH_TOKEN}@github.com/luzifer-docker/openfire master --tags
|