77 push :
88 branches :
99 - ' v4'
10- # FIXME : re-enable after testing
11- # schedule:
12- # - cron: '42 3 * * 0'
10+ schedule :
11+ - cron : ' 42 3 * * 0'
1312
1413jobs :
15- build :
14+ test :
1615 strategy :
1716 fail-fast : false
1817 matrix :
2120# builder: [ {arch: "amd64", os: "ubuntu-latest"}, {arch: "arm64", os: "macos-latest"}]
2221 builder : [ {arch: "amd64", os: "ubuntu-latest"}, {arch: "arm64", os: "ubuntu-latest"}]
2322 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 }} - only ${{ matrix.builder.arch }
2624 steps :
2725 - name : Checkout
2826 uses : actions/checkout@v3
@@ -58,12 +56,11 @@ jobs:
5856
5957 publish :
6058 # 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' }}
6360 needs :
64- - build
61+ - test
6562 runs-on : ubuntu-latest
66- name : Publish multi-arch to dockerhub
63+ name : Publish ${{ matrix.php_version }}-${{ matrix.variant }} multi-arch to dockerhub
6764 strategy :
6865 fail-fast : false
6966 matrix :
@@ -81,24 +78,41 @@ jobs:
8178 with :
8279 username : ${{ secrets.DOCKERHUB_USERNAME }}
8380 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
8582 run : |
8683 PHP_VERSION="${{ matrix.php_version }}"
87-
8884 TAG_PREFIX="rc${GITHUB_SHA::7}-" \
8985 docker buildx bake \
9086 --set "*.platform=linux/amd64,linux/arm64" \
9187 --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
9392 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 : |
9496 PHP_VERSION="${{ matrix.php_version }}"
95-
96- TAG_PREFIX="rc${GITHUB_SHA::7}-" \
9797 PHP_PATCH_MINOR="${PHP_VERSION_MINOR}" \
9898 docker buildx bake \
9999 --set "*.platform=linux/amd64,linux/arm64" \
100100 --set "*.output=type=registry" \
101+ --metadata-file "/tmp/digests-php${PHP_VERSION//.}-${{ matrix.variant }}.log"
101102 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
102109 - name : Display tags built
103110 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