diff --git a/.travis.yml b/.travis.yml index 38d217502..0456973a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,11 +41,17 @@ before_deploy: - ./build.sh ${TRAVIS_TAG#?} deploy: - provider: releases - api_key: - secure: a9dbZchocqeuOViwUeNH54bQR5Sz7rEYXx5b9WPFtnFn9LGKKUaLbA2U91UQ9QKPrcTpsALubUYbw2CnNmvCwzaY+R8lCD3gkU4ohsEnbpnw3deOeixI74sqBHJAuCH9FSaRDGILoBMtUKx2xlzIymFxkIsgIukkGbdkWHDlRWY3oTUUuw1SQ2Xk9KDsbJQtjIc1+G/O6gHaV4qv/R9W8NPmJExKTNDrAZbC1vIUnxqp4UpVo1hst8qPd1at94CndDYM5rG+7imGbdtxTxzamt819qdTO1OfvtctKawNAm7YXZrrWft6c7gI6j6SI4hxd+ZrrPBqbaRFHkZHjnNssO/yn4SaOHFFzccmu0MzvpPCf0qWZwd3sGHVYer1MnR2mHYqU84QPlW3nrHwJjkrpq3+q0JcBY6GsJs+RskHNtkMTKV05Iz6QUI5YZGwTpuXaRm036SmavjGc4IDlMaYCk/NmbB9BKpthJxLdUpczOHpnjXXHziotWD6cfEnbjU3byfD8HY5WrxSjsNT7SKmXN3hRof7bk985ewQVjGT42O3NbnfnqjQQWr/B7/zFTpLR4f526Bkq12CdCyf5lvrbq+POkLVdJ+uFfR7ds248Ue/jBQy6kM1tWmKF9QiwisFlA84eQ4CW3I93Rp97URv+AQa9zmbD0Ve3Udp+g6nF5I= - file: "./build/shlink_${TRAVIS_TAG#?}_dist.zip" - skip_cleanup: true - on: - tags: true - php: 7.1 + - provider: releases + api_key: + secure: a9dbZchocqeuOViwUeNH54bQR5Sz7rEYXx5b9WPFtnFn9LGKKUaLbA2U91UQ9QKPrcTpsALubUYbw2CnNmvCwzaY+R8lCD3gkU4ohsEnbpnw3deOeixI74sqBHJAuCH9FSaRDGILoBMtUKx2xlzIymFxkIsgIukkGbdkWHDlRWY3oTUUuw1SQ2Xk9KDsbJQtjIc1+G/O6gHaV4qv/R9W8NPmJExKTNDrAZbC1vIUnxqp4UpVo1hst8qPd1at94CndDYM5rG+7imGbdtxTxzamt819qdTO1OfvtctKawNAm7YXZrrWft6c7gI6j6SI4hxd+ZrrPBqbaRFHkZHjnNssO/yn4SaOHFFzccmu0MzvpPCf0qWZwd3sGHVYer1MnR2mHYqU84QPlW3nrHwJjkrpq3+q0JcBY6GsJs+RskHNtkMTKV05Iz6QUI5YZGwTpuXaRm036SmavjGc4IDlMaYCk/NmbB9BKpthJxLdUpczOHpnjXXHziotWD6cfEnbjU3byfD8HY5WrxSjsNT7SKmXN3hRof7bk985ewQVjGT42O3NbnfnqjQQWr/B7/zFTpLR4f526Bkq12CdCyf5lvrbq+POkLVdJ+uFfR7ds248Ue/jBQy6kM1tWmKF9QiwisFlA84eQ4CW3I93Rp97URv+AQa9zmbD0Ve3Udp+g6nF5I= + file: "./build/shlink_${TRAVIS_TAG#?}_dist.zip" + skip_cleanup: true + on: + tags: true + php: 7.1 + - provider: script + script: bash data/travis/trigger_docker_build.sh + skip_cleanup: true + on: + tags: true + php: 7.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6118280a6..2918aadec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org). -## [Unreleased] +## 1.15.1 - 2018-12-16 #### Added @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), * [#312](https://github.com/shlinkio/shlink/issues/312) Now all config files both in `php` and `json` format are loaded from `config/params` folder, easing users to provided customizations to docker image. * [#226](https://github.com/shlinkio/shlink/issues/226) Updated how table are rendered in CLI commands, making use of new features in Symfony 4.2. * [#321](https://github.com/shlinkio/shlink/issues/321) Extracted entities mappings from entities to external config files. +* [#308](https://github.com/shlinkio/shlink/issues/308) Automated docker image building. #### Deprecated diff --git a/build.sh b/build.sh index cbcaa180b..cab2f4d3d 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e -if [ "$#" -ne 1 ]; then +if [[ "$#" -ne 1 ]]; then echo "Usage:" >&2 echo " $0 {version}" >&2 exit 1 @@ -10,7 +10,7 @@ fi version=$1 builtcontent="./build/shlink_${version}_dist" projectdir=$(pwd) -[ -f ./composer.phar ] && composerBin='./composer.phar' || composerBin='composer' +[[ -f ./composer.phar ]] && composerBin='./composer.phar' || composerBin='composer' # Copy project content to temp dir echo 'Copying project files...' @@ -18,6 +18,7 @@ rm -rf "${builtcontent}" mkdir -p "${builtcontent}" rsync -av * "${builtcontent}" \ --exclude=data/infra \ + --exclude=data/travis \ --exclude=data/migrations_template.txt \ --exclude=data/GeoLite2-City.mmdb \ --exclude=**/.gitignore \ diff --git a/data/travis/trigger_docker_build.sh b/data/travis/trigger_docker_build.sh new file mode 100644 index 000000000..565b30b50 --- /dev/null +++ b/data/travis/trigger_docker_build.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +# Get latest commit in master, in plain text +LATEST_MASTER_COMMIT=$(curl -H "Accept: application/vnd.github.sha" -X GET https://api.github.com/repos/shlinkio/shlink-docker-image/commits/master) + +# Create new tag and a ref to the tag, which will trigger image build on it +curl -u acelaya:${GITHUB_OAUTH_KEY} \ + -H "Content-Type: application/json" \ + --data "{ \"tag\": \"${TRAVIS_TAG}\", \"message\": \"${TRAVIS_TAG}\", \"object\": \"${LATEST_MASTER_COMMIT}\", \"type\": \"commit\" }" \ + -X POST https://api.github.com/repos/shlinkio/shlink-docker-image/git/tags +curl -u acelaya:${GITHUB_OAUTH_KEY} \ + -H "Content-Type: application/json" \ + --data "{ \"ref\": \"refs/tags/${TRAVIS_TAG}\", \"sha\": \"${LATEST_MASTER_COMMIT}\" }" \ + -X POST https://api.github.com/repos/shlinkio/shlink-docker-image/git/refs + +# Trigger image build for "latest +curl -H "Content-Type: application/json" \ + --data '{ "docker_tag": "latest" }' \ + -X POST https://registry.hub.docker.com/u/shlinkio/shlink/trigger/${DOCKER_TRIGGER_TOKEN}/