Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically push specific version tags via Travis CI #9

Closed
geerlingguy opened this issue Dec 16, 2018 · 4 comments
Closed

Automatically push specific version tags via Travis CI #9

geerlingguy opened this issue Dec 16, 2018 · 4 comments

Comments

@geerlingguy
Copy link
Owner

geerlingguy commented Dec 16, 2018

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:

  1. Runs the built image:
docker run --rm image/name:latest ...
  1. 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();')
  1. Tags the image with that version and pushes that tag too.
@geerlingguy
Copy link
Owner Author

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
Copy link
Owner Author

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
Copy link
Owner Author

I only needed the PHP_RELEASE_VERSION for tagging purposes (already had major.minor), so the commit above reflects that.

@geerlingguy
Copy link
Owner Author

Works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant