Skip to content

Commit

Permalink
Merge pull request #9 from maksymz/php-csfixer-3-57-2-and-multiplatfo…
Browse files Browse the repository at this point in the history
…rm-support

PHP CS Fixer v3.57.2
  • Loading branch information
mcfedr authored May 24, 2024
2 parents 390c73f + f15f825 commit a31cbba
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/release-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name: Create and publish a Docker image
on:
push:
branches: ['*']
pull_request:

jobs:
checks-update:
Expand Down Expand Up @@ -67,22 +68,26 @@ jobs:
packages: write
strategy:
matrix:
version: ['1','2.19','2','3.12','3.13', '3']
# Update only v3 images without touching older ones to better manage back-compatibility
version: ['3.12', '3.13', '3.57', '3']
needs: [checks-hadolint, checks-shfmt, checks-shellcheck, checks-update]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
Expand All @@ -94,9 +99,11 @@ jobs:
latest=${{ toJSON(matrix.version == '3' && github.ref == 'refs/heads/main') }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: ${{ matrix.version }}
# Build for Linux and Apple Silicon processors
platforms: linux/amd64,linux/arm64,linux/arm64/v8
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
4 changes: 2 additions & 2 deletions 3.17/Dockerfile → 3.57/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM php:8.2-alpine
FROM php:8.3-alpine

ENV PHP_CS_FIXER_VERSION 3.17.0
ENV PHP_CS_FIXER_VERSION 3.57.2
# hadolint ignore=DL3018
RUN curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v$PHP_CS_FIXER_VERSION/php-cs-fixer.phar -o php-cs-fixer \
&& chmod +x php-cs-fixer \
Expand Down
4 changes: 2 additions & 2 deletions 3/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM php:8.0-alpine
FROM php:8.3-alpine

ENV PHP_CS_FIXER_VERSION 3.13.2
ENV PHP_CS_FIXER_VERSION 3.57.2
# hadolint ignore=DL3018
RUN curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v$PHP_CS_FIXER_VERSION/php-cs-fixer.phar -o php-cs-fixer \
&& chmod +x php-cs-fixer \
Expand Down
24 changes: 13 additions & 11 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,25 @@ set -e

# https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases
declare -A variants=(
['3.17']='3.17.0'
['3']='3.13.2'
['3']='3.57.2'
['3.57']='3.57.2'
['3.13']='3.13.2'
['3.12']='3.12.0'
['2']='2.19.3'
['2.19']='2.19.3'
['1']='1.13.3'
# Don't rebuild old images
# ['2']='2.19.3'
# ['2.19']='2.19.3'
# ['1']='1.13.3'
)

declare -A php_version=(
['3.17']='8.2'
['3']='8.0'
['3']='8.3'
['3.57']='8.3'
['3.13']='8.1'
['3.12']='8.1'
['2']='8.0'
['2.19']='8.0'
['1']='7.1'
# Don't rebuild old images
# ['2']='8.0'
# ['2.19']='8.0'
# ['1']='7.1'
)

for variant in "${!variants[@]}"; do
Expand All @@ -39,5 +41,5 @@ for variant in "${!variants[@]}"; do
'"$extraSed"'
s/%%VARIANT%%/'"${variants[$variant]}"'/;
s/%%PHP_VERSION%%/'"${php_version[$variant]}"'/;
' $template >"$dir/Dockerfile"
' "$template" >"$dir/Dockerfile"
done

0 comments on commit a31cbba

Please sign in to comment.