7
7
push :
8
8
branches :
9
9
- ' v4'
10
- # FIXME : re-enable after testing
11
- # schedule:
12
- # - cron: '42 3 * * 0'
10
+ schedule :
11
+ - cron : ' 42 3 * * 0'
13
12
14
13
jobs :
15
- build :
14
+ test :
16
15
strategy :
17
16
fail-fast : false
18
17
matrix :
21
20
# builder: [ {arch: "amd64", os: "ubuntu-latest"}, {arch: "arm64", os: "macos-latest"}]
22
21
builder : [ {arch: "amd64", os: "ubuntu-latest"}, {arch: "arm64", os: "ubuntu-latest"}]
23
22
runs-on : ${{ matrix.builder.os }}
24
- # runs-on: self-hosted
25
- name : Build & test ${{ matrix.php_version }}-${{ matrix.variant }} (${{ matrix.builder.arch }})
23
+ name : Test ${{ matrix.php_version }}-${{ matrix.variant }} ${{ matrix.builder.arch }} only
26
24
steps :
27
25
- name : Checkout
28
26
uses : actions/checkout@v3
@@ -58,12 +56,11 @@ jobs:
58
56
59
57
publish :
60
58
# push ~ schedule
61
- # FIXME : re-enable after testing
62
- # if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
59
+ if : ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
63
60
needs :
64
- - build
61
+ - test
65
62
runs-on : ubuntu-latest
66
- name : Publish multi-arch to dockerhub
63
+ name : Publish ${{ matrix.php_version }}-${{ matrix.variant }} multi-arch to dockerhub
67
64
strategy :
68
65
fail-fast : false
69
66
matrix :
@@ -81,24 +78,41 @@ jobs:
81
78
with :
82
79
username : ${{ secrets.DOCKERHUB_USERNAME }}
83
80
password : ${{ secrets.DOCKERHUB_TOKEN }}
84
- - name : Build and push ${{ matrix.php_version }}-${{ matrix.variant }} as multiarch (amd64 and arm64)
81
+ - name : Build and push ${{ matrix.php_version }}-${{ matrix.variant }} with tagged prefix
85
82
run : |
86
83
PHP_VERSION="${{ matrix.php_version }}"
87
-
88
84
TAG_PREFIX="rc${GITHUB_SHA::7}-" \
89
85
docker buildx bake \
90
86
--set "*.platform=linux/amd64,linux/arm64" \
91
87
--set "*.output=type=registry" \
92
- php${PHP_VERSION//.}-slim-${{ matrix.variant }}
88
+ php${PHP_VERSION//.}-${{ matrix.variant }}-all
89
+ - name : Fetch minor version of php
90
+ run : |
91
+ # Retrieve minor version
93
92
PHP_PATCH_MINOR=`docker run --rm thecodingmachine/php:rc-${GITHUB_SHA::7}-${{ matrix.php_version }}-v4-slim-${{ matrix.variant }} php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1`
93
+ echo "PHP_PATCH_MINOR=${PHP_PATCH_MINOR}" >> $GITHUB_ENV
94
+ - name : Build and push ${{ matrix.php_version }}-${{ matrix.variant }} with releases tags (major and minor)
95
+ run : |
94
96
PHP_VERSION="${{ matrix.php_version }}"
95
-
96
- TAG_PREFIX="rc${GITHUB_SHA::7}-" \
97
97
PHP_PATCH_MINOR="${PHP_VERSION_MINOR}" \
98
98
docker buildx bake \
99
99
--set "*.platform=linux/amd64,linux/arm64" \
100
100
--set "*.output=type=registry" \
101
+ --metadata-file "/tmp/digests-php${PHP_VERSION//.}-${{ matrix.variant }}.log"
101
102
php${PHP_VERSION//.}-${{ matrix.variant }}-all
103
+ - name : Artifacts
104
+ uses : actions/upload-artifact@v3
105
+ with :
106
+ name : digests-${{ matrix.php_version }}-${{ matrix.variant }}
107
+ path : /tmp/digests-php${PHP_VERSION//.}-${{ matrix.variant }}.log
108
+ retention-days : 60
102
109
- name : Display tags built
103
110
run : |
104
- docker image ls --filter="reference=thecodingmachine/php" --format "{{.CreatedAt}}\t{{.Size}}\t{{.Repository}}:{{.Tag}}"
111
+ echo "With prefix :"
112
+ TAG_PREFIX="rc${GITHUB_SHA::7}-" \
113
+ docker buildx bake php${PHP_VERSION//.}-${{ matrix.variant }}-all --print --progress plain | jq ".target[].tags | join(\" \")" -r
114
+ echo "-----"
115
+ echo "Regular :"
116
+ PHP_PATCH_MINOR="${PHP_VERSION_MINOR}" \
117
+ docker buildx bake php${PHP_VERSION//.}-${{ matrix.variant }}-all --print --progress plain | jq ".target[].tags | join(\" \")" -r
118
+
0 commit comments