Skip to content

Commit 8485387

Browse files
committed
Add cache
Add artifacts for debug
1 parent 2a39e59 commit 8485387

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

.github/workflows/workflow.yml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,17 @@ jobs:
8181
- name: Build and push ${{ matrix.php_version }}-${{ matrix.variant }} with tagged prefix
8282
run: |
8383
PHP_VERSION="${{ matrix.php_version }}"
84+
mkdir -p /tmp/build-cache
8485
TAG_PREFIX="rc${GITHUB_SHA::7}-" \
8586
docker buildx bake \
8687
--set "*.platform=linux/amd64,linux/arm64" \
88+
--cache-to "type=local,mode=max,dest=/tmp/build-cache" \
8789
--set "*.output=type=registry" \
8890
php${PHP_VERSION//.}-${{ matrix.variant }}-all
8991
- name: Fetch minor version of php
9092
run: |
9193
# Retrieve minor version
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`
94+
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`
9395
echo "PHP_PATCH_MINOR=${PHP_PATCH_MINOR}" >> $GITHUB_ENV
9496
- name: Build and push ${{ matrix.php_version }}-${{ matrix.variant }} with releases tags (major and minor)
9597
run: |
@@ -98,21 +100,23 @@ jobs:
98100
docker buildx bake \
99101
--set "*.platform=linux/amd64,linux/arm64" \
100102
--set "*.output=type=registry" \
101-
--metadata-file "/tmp/digests-php${PHP_VERSION//.}-${{ matrix.variant }}.log"
103+
--cache-to "type=local,mode=max,dest=/tmp/build-cache" \
104+
--cache-from "type=local,mode=max,dest=/tmp/build-cache" \
105+
--metadata-file "/tmp/digests.log"
102106
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
109107
- name: Display tags built
110108
run: |
111-
echo "With prefix :"
109+
echo "With prefix :" > "/tmp/tags.log"
112110
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 :"
111+
docker buildx bake php${PHP_VERSION//.}-${{ matrix.variant }}-all --print --progress plain | jq ".target[].tags | join(\" \")" -r >> "/tmp/tags.log"
112+
echo "-----" >> "/tmp/tags.log"
113+
echo "Regular :" >> "/tmp/tags.log"
116114
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-
115+
docker buildx bake php${PHP_VERSION//.}-${{ matrix.variant }}-all --print --progress plain | jq ".target[].tags | join(\" \")" -r >> "/tmp/tags.log"
116+
cat "/tmp/tags.log"
117+
- name: Artifacts
118+
uses: actions/upload-artifact@v3
119+
with:
120+
name: ${{ matrix.php_version }}-${{ matrix.variant }}-logs
121+
path: /tmp/{digests,tag}.log
122+
retention-days: 60

0 commit comments

Comments
 (0)