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

Comments

1 participant
@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

This comment has been minimized.

Copy link
Owner

geerlingguy commented Dec 16, 2018

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

This comment has been minimized.

Copy link
Owner

geerlingguy commented Dec 16, 2018

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

This comment has been minimized.

Copy link
Owner

geerlingguy commented Dec 16, 2018

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

geerlingguy added a commit that referenced this issue Dec 16, 2018

@geerlingguy

This comment has been minimized.

Copy link
Owner

geerlingguy commented Dec 16, 2018

Works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment