Skip to content

Commit

Permalink
feat: add php-version argument to control which PHP version to use
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasnorre committed Jan 24, 2025
1 parent 4405db0 commit 99b0bff
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
13 changes: 11 additions & 2 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand Down
9 changes: 9 additions & 0 deletions Docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -21,6 +23,7 @@ jobs:
- uses: tomasnorre/typo3-upload-ter@v2
with:
api-token: ${{ secrets.TYPO3_API_TOKEN }}
php-version: 8.3
```
### Requirement
Expand Down
9 changes: 7 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
- ${{ inputs.api-token }}
- ${{ inputs.php-version }}

0 comments on commit 99b0bff

Please sign in to comment.