Repository navigation
74 lines (69 loc) · 2.3 KB
/
Copy pathphp-cli.yml
File metadata and controls
74 lines (69 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: PHP CLI build images
on:
pull_request:
paths: ['php-cli/**', '.github/workflows/php-cli.yml']
push:
branches: [master]
paths: ['php-cli/**', '.github/workflows/php-cli.yml']
workflow_dispatch:
permissions:
contents: read
concurrency:
group: php-cli-${{ github.ref }}
cancel-in-progress: true
jobs:
matrix:
runs-on: ubuntu-latest
outputs:
images: ${{ steps.manifest.outputs.images }}
steps:
- uses: actions/checkout@v7
- id: manifest
run: |
echo "images=$(jq -c '.images' php-cli/images.json)" >> "$GITHUB_OUTPUT"
build-test:
needs: matrix
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.matrix.outputs.images) }}
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v4
- name: Build PHP ${{ matrix.version }}
uses: docker/build-push-action@v7
with:
context: php-cli
build-args: BASE_IMAGE=${{ matrix.baseImage }}
platforms: linux/amd64
pull: true
load: true
tags: intercube-php-cli:test
cache-from: type=gha,scope=php-cli-${{ matrix.version }}
cache-to: type=gha,mode=max,scope=php-cli-${{ matrix.version }}
- name: Verify extensions and non-root Composer
env:
BASE_IMAGE: ${{ matrix.baseImage }}
PHP_VERSION: ${{ matrix.version }}
run: bash php-cli/test-image.sh intercube-php-cli:test "$BASE_IMAGE" "$PHP_VERSION"
- name: Log in to GHCR
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish tested image
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
env:
PHP_VERSION: ${{ matrix.version }}
run: |
image="ghcr.io/intercube/docker/php-cli"
for tag in "$PHP_VERSION-latest" "$PHP_VERSION-$GITHUB_SHA-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT"; do
docker tag intercube-php-cli:test "$image:$tag"
docker push "$image:$tag"
done