Automatically push specific version tags via Travis CI
Closed this issue · 4 comments
geerlingguy commented
I don't want to have to manually push specific PHP version tags (e.g. 5.6.32
or 7.3.1
), so I need to write a tiny bit of extra automation in the .travis.yml
file which:
- Runs the built image:
docker run --rm image/name:latest ...
- Gets the PHP version like:
# This seems simplest:
php_version=$(php -r "echo PHP_VERSION;")
# Or this also works...
php_version=$(php -r 'echo phpversion();')
- Tags the image with that version and pushes that tag too.
geerlingguy commented
Hmm...
version=$(docker run --rm geerlingguy/php-apache:7.3 bash -c "php -r 'echo phpversion();'")
$ echo $version
7.3.0-1+0~20181206202713.23+stretch~1.gbp076afd
Need to just get major/minor/patch.
geerlingguy commented
This works. Annoyingly long, but it works:
$ php_version=$(docker run --rm geerlingguy/php-apache:7.3 bash -c "php -r 'echo PHP_MAJOR_VERSION . \".\" . PHP_MINOR_VERSION . \".\" . PHP_RELEASE_VERSION;'")
$ echo $php_version
7.3.0
geerlingguy commented
I only needed the PHP_RELEASE_VERSION
for tagging purposes (already had major.minor), so the commit above reflects that.
geerlingguy commented
Works!