From 99b0bff303126ae94f88e362593e8a1aaabdb1d4 Mon Sep 17 00:00:00 2001 From: Tomas Norre Mikkelsen Date: Fri, 24 Jan 2025 21:28:18 +0100 Subject: [PATCH] feat: add php-version argument to control which PHP version to use --- Docker/Dockerfile | 13 +++++++++++-- Docker/entrypoint.sh | 9 +++++++++ README.md | 3 +++ action.yml | 9 +++++++-- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Docker/Dockerfile b/Docker/Dockerfile index f612e6f..723a1d2 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -1,15 +1,24 @@ FROM composer:2 FROM bash:5 -FROM php:8.3-alpine +FROM php:8.1-alpine # copy from the images into the PHP Image COPY --from=composer /usr/bin/composer /usr/bin/composer COPY --from=bash /usr/local/bin/bash /usr/bin/bash +COPY --from=php:8.1-alpine /usr/local/bin/php /usr/bin/php81 COPY entrypoint.sh /entrypoint.sh +RUN apk --no-cache add php82-cli php83-cli php84-cli \ + php82-common php83-common php84-common \ + php82-curl php83-curl php84-curl \ + php82-intl php83-intl php84-intl \ + php82-soap php83-soap php84-soap \ + php82-xml php83-xml php84-xml \ + php82-zip php83-zip php84-zip + RUN apk update && apk upgrade && \ - apk add bash git jq libxml2-dev libzip-dev icu-dev curl && \ + apk add git jq libxml2-dev libzip-dev icu-dev curl && \ rm -rf /var/cache/apk/* RUN docker-php-ext-install soap && \ diff --git a/Docker/entrypoint.sh b/Docker/entrypoint.sh index 1fc7770..2b27c4d 100755 --- a/Docker/entrypoint.sh +++ b/Docker/entrypoint.sh @@ -1,5 +1,14 @@ #!/usr/bin/env bash +# Check if an argument is provided (e.g., 8.3) +if [[ -z "$2" ]]; then + echo "Keeping default: PHP 8.3" + ln -sf /usr/bin/php83 /usr/local/bin/php +else + PHP=$(echo "$2" | tr -d '.') + ln -sf /usr/bin/php"$PHP" /usr/local/bin/php +fi + echo -e "Preparing git configuration (safe.directory)\n"; git config --global --add safe.directory $PWD diff --git a/README.md b/README.md index 533f064..ab9ae99 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # typo3-upload-ter GitHub Action GitHub Action that helps you upload your Extensions to [TER](https://extensions.typo3.org). +Supported PHP Version 8.1, 8.2, 8.3 and 8.4, if no parameter is given PHP 8.3 is used. + ## Example usage ```yaml @@ -21,6 +23,7 @@ jobs: - uses: tomasnorre/typo3-upload-ter@v2 with: api-token: ${{ secrets.TYPO3_API_TOKEN }} + php-version: 8.3 ``` ### Requirement diff --git a/action.yml b/action.yml index bfeeef3..44e83b1 100644 --- a/action.yml +++ b/action.yml @@ -4,12 +4,17 @@ branding: icon: upload color: orange inputs: - api-token: # id of input + api-token: description: 'Your TYPO3 API Token - Use github.secrets' required: true default: '' + php-version: + description: 'The PHP version that you want to use for your action' + required: false + default: '8.3' runs: using: 'docker' image: 'Dockerfile' args: - - ${{ inputs.api-token }} \ No newline at end of file + - ${{ inputs.api-token }} + - ${{ inputs.php-version }} \ No newline at end of file