From 6337fd9766cfd5ee31f7fbeeb863f347821da914 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Thu, 25 Apr 2024 18:38:12 -0500 Subject: [PATCH 1/7] Cleanup README. --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e686fb7..67589ef 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Fast builds for repositories using php-actions. +# Fast builds for repositories using php-actions v1 of this repository used a totally different architecture and had different goals to the current version. Previously, a customised Dockerfile was used as the base for all php-actions repositories, but now php-actions workflows run as [composite run steps][composite], building a customised docker image per-application, based off the official PHP script. @@ -25,7 +25,7 @@ Choosing the PHP version The `ACTION_PHP_VERSION` environment variable must be passed to the composite run step. This string must match any of the [officially supported PHP version numbers][tag-list] (version number only, with no derivative text, e.g. `8.0.1` or `8` rather than `8-cli`). -The official Alpine CLI build of the requested version will be used as the image's base. +The official Alpine CLI build of the requested version will be used as the image's base. Enabling/disabling extensions ----------------------------- @@ -46,7 +46,7 @@ Version caching php-build This repo, `php-build` shouldn't change very regularly, but when it does, the entire build pipeline of dependent repositories will need refreshing. This is done by adding the version of `php-build` to the end of build package names. When a new release is made that affects php-build functionality, the variable at the top of `php-build.bash` can be updated to invalidate any caches. -Within other repositories that use `php-build`, they can refer to the specific version of the script by addressing its git commit hash. For example: https://raw.githubusercontent.com/php-actions/php-build/27be075494ae8a9bc0d10deb408e37b197986b8a/php-build.bash +Within other repositories that use `php-build`, they can refer to the specific version of the script by addressing its git commit hash. For example: *** @@ -57,5 +57,4 @@ If you found this repository helpful, please consider [sponsoring the developer] [tag-list]: https://github.com/docker-library/docs/blob/master/php/README.md#supported-tags-and-respective-dockerfile-links [mlocati]: https://github.com/mlocati/docker-php-extension-installer [mlocati-readme]: https://github.com/mlocati/docker-php-extension-installer#supported-php-extensions -[issues]: https://github.com/php-actions/php-build/issues [sponsor]: https://github.com/sponsors/g105b From d8d59bd1e659388479a49de58ff000efcd6f33f1 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Thu, 25 Apr 2024 18:38:29 -0500 Subject: [PATCH 2/7] Check for any PHP version updates. --- php-build.bash | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) mode change 100644 => 100755 php-build.bash diff --git a/php-build.bash b/php-build.bash old mode 100644 new mode 100755 index b977aca..b0dc8d9 --- a/php-build.bash +++ b/php-build.bash @@ -104,7 +104,20 @@ echo "Pulling $docker_tag" >> output.log 2>&1 # No need to continue building the image if the pull was successful. if docker pull "$docker_tag" >> output.log 2>&1; then - exit + # Unless the PHP version has an update... + + # Pull latest PHP Docker image so we can check its version + echo "Pulling $base_image" >> output.log 2>&1 + docker pull "$base_image" >> output.log 2>&1 + + # Check PHP version of the latest PHP tag and our tag + base_image_php_version=$(docker run -it "$base_image" php -r "echo PHP_VERSION;") + new_image_php_version=$(docker run -it "$docker_tag" php -r "echo PHP_VERSION;") + + if new_image_php_version == base_image_php_version; + then + exit + fi fi echo "Building PHP $ACTION_PHP_VERSION with extensions: $ACTION_PHP_EXTENSIONS ..." From 3a1ae6c73ce245cdddc6e8634a046fe41209e082 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Thu, 25 Apr 2024 18:51:04 -0500 Subject: [PATCH 3/7] Cleanup. --- php-build.bash | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/php-build.bash b/php-build.bash index b0dc8d9..93e50ee 100755 --- a/php-build.bash +++ b/php-build.bash @@ -106,15 +106,18 @@ if docker pull "$docker_tag" >> output.log 2>&1; then # Unless the PHP version has an update... - # Pull latest PHP Docker image so we can check its version + # Pull latest PHP Docker image so we can check its version. echo "Pulling $base_image" >> output.log 2>&1 docker pull "$base_image" >> output.log 2>&1 - # Check PHP version of the latest PHP tag and our tag + # Check PHP versions of the latest PHP tag and our tag. base_image_php_version=$(docker run -it "$base_image" php -r "echo PHP_VERSION;") - new_image_php_version=$(docker run -it "$docker_tag" php -r "echo PHP_VERSION;") + cached_image_php_version=$(docker run -it "$docker_tag" php -r "echo PHP_VERSION;") - if new_image_php_version == base_image_php_version; + echo "Comparing $cached_image_php_version (cached) to $base_image_php_version (latest)." >> output.log 2>&1 + + # No need to continue building if our image already exists and PHP is up-to-date. + if cached_image_php_version == base_image_php_version; then exit fi From 7dc684542ea162b25af8dda1fca1ec5e7c5fb254 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Thu, 25 Apr 2024 19:11:43 -0500 Subject: [PATCH 4/7] Fix TTY & docs. --- php-build.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/php-build.bash b/php-build.bash index 93e50ee..bd90b47 100755 --- a/php-build.bash +++ b/php-build.bash @@ -88,8 +88,8 @@ dockerfile_unique="${dockerfile_unique,,}" repo_without_org=$(echo "$GITHUB_REPOSITORY" | sed "s/[^\/]*\///") # This tag will be used to identify the built dockerfile. Once it is built, -# it should not need to be built again, so after the first Github Actions run -# the build should be very quick. +# it should not need to be built again unless there is a PHP update, so after +# the first Github Actions run the build should be very quick. # Note: The GITHUB_REPOSITORY is the repo where the action is running, nothing # to do with the php-actions organisation. This means that the image is pushed # onto a user's Github profile (currently not shared between other users). @@ -111,8 +111,8 @@ then docker pull "$base_image" >> output.log 2>&1 # Check PHP versions of the latest PHP tag and our tag. - base_image_php_version=$(docker run -it "$base_image" php -r "echo PHP_VERSION;") - cached_image_php_version=$(docker run -it "$docker_tag" php -r "echo PHP_VERSION;") + base_image_php_version=$(docker run -i "$base_image" php -r "echo PHP_VERSION;") + cached_image_php_version=$(docker run -i "$docker_tag" php -r "echo PHP_VERSION;") echo "Comparing $cached_image_php_version (cached) to $base_image_php_version (latest)." >> output.log 2>&1 From 8e4f67591c57575c954831ad5ad7928ff4d0e230 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Thu, 25 Apr 2024 19:20:07 -0500 Subject: [PATCH 5/7] Fix variable references. --- php-build.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php-build.bash b/php-build.bash index bd90b47..f92302f 100755 --- a/php-build.bash +++ b/php-build.bash @@ -117,7 +117,7 @@ then echo "Comparing $cached_image_php_version (cached) to $base_image_php_version (latest)." >> output.log 2>&1 # No need to continue building if our image already exists and PHP is up-to-date. - if cached_image_php_version == base_image_php_version; + if [ $cached_image_php_version == $base_image_php_version ]; then exit fi From e8ecba262ff37e0d27f14866c9c6ab9ac563fa74 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Fri, 26 Apr 2024 08:28:14 -0500 Subject: [PATCH 6/7] Version bump --- php-build.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php-build.bash b/php-build.bash index f92302f..2414ea6 100755 --- a/php-build.bash +++ b/php-build.bash @@ -1,7 +1,7 @@ #!/bin/bash set -e -php_build_version="build2.1.1" +php_build_version="build2.1.2" # Check for required variables: if [ "$#" -lt 1 ]; then From 42c9f3eb6da8f34435551900d23ff7978e1c463d Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Fri, 26 Apr 2024 11:07:49 -0500 Subject: [PATCH 7/7] Fix version number. --- php-build.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php-build.bash b/php-build.bash index 2414ea6..165d252 100755 --- a/php-build.bash +++ b/php-build.bash @@ -1,7 +1,7 @@ #!/bin/bash set -e -php_build_version="build2.1.2" +php_build_version="build2.2.1" # Check for required variables: if [ "$#" -lt 1 ]; then