|
36 | 36 | - name: Build
|
37 | 37 | run: |
|
38 | 38 | PHP_VERSION="${{ matrix.php_version }}"
|
39 |
| - TAG_PREFIX="rc${GITHUB_SHA::7}-" \ |
| 39 | + TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ |
40 | 40 | docker buildx bake \
|
41 | 41 | --set "*.platform=linux/${{ matrix.builder.arch }}" \
|
42 | 42 | --set "*.output=type=docker" \
|
|
47 | 47 | docker image ls --filter="reference=thecodingmachine/php" --format "{{.CreatedAt}}\t{{.Size}}\t{{.Repository}}:{{.Tag}}"
|
48 | 48 | - name: Test
|
49 | 49 | run: |
|
50 |
| - TAG_PREFIX="rc${GITHUB_SHA::7}-" \ |
| 50 | + TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ |
51 | 51 | PHP_VERSION="${{ matrix.php_version }}" \
|
52 | 52 | BRANCH="v4" \
|
53 | 53 | VARIANT="${{ matrix.variant }}" \
|
@@ -78,45 +78,40 @@ jobs:
|
78 | 78 | with:
|
79 | 79 | username: ${{ secrets.DOCKERHUB_USERNAME }}
|
80 | 80 | password: ${{ secrets.DOCKERHUB_TOKEN }}
|
81 |
| - - name: Build and push ${{ matrix.php_version }}-${{ matrix.variant }} with tagged prefix |
| 81 | + - name: Fetch minor version of php |
82 | 82 | run: |
|
| 83 | + # Build slim one |
83 | 84 | PHP_VERSION="${{ matrix.php_version }}"
|
84 |
| - mkdir -p /tmp/build-cache |
85 |
| - TAG_PREFIX="rc${GITHUB_SHA::7}-" \ |
| 85 | + TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ |
86 | 86 | docker buildx bake \
|
87 |
| - --set "*.platform=linux/amd64,linux/arm64" \ |
88 |
| - --cache-to "type=local,mode=max,dest=/tmp/build-cache" \ |
89 |
| - --set "*.output=type=registry" \ |
90 |
| - php${PHP_VERSION//.}-${{ matrix.variant }}-all |
91 |
| - - name: Fetch minor version of php |
92 |
| - run: | |
93 |
| - # Retrieve minor version |
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` |
| 87 | + --set "*.platform=linux/amd64" \ |
| 88 | + --set "*.output=type=docker" \ |
| 89 | + --load \ |
| 90 | + php${PHP_VERSION//.}-slim-${{ matrix.variant }} |
| 91 | + # Retrieve minor |
| 92 | + PHP_PATCH_MINOR=`docker run --rm thecodingmachine/php:rc${GITHUB_RUN_ID}-${{ matrix.php_version }}-v4-slim-${{ matrix.variant }} php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1` |
95 | 93 | echo "PHP_PATCH_MINOR=${PHP_PATCH_MINOR}" >> $GITHUB_ENV
|
96 |
| - - name: Build and push ${{ matrix.php_version }}-${{ matrix.variant }} with releases tags (major and minor) |
| 94 | + - name: Display tags to build |
| 95 | + run: | |
| 96 | + PHP_VERSION="${{ matrix.php_version }}" |
| 97 | + PHP_PATCH_MINOR="${{ env.PHP_PATCH_MINOR }}" \ |
| 98 | + TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ |
| 99 | + IS_RELEASE="1" \ |
| 100 | + docker buildx bake php${PHP_VERSION//.}-${{ matrix.variant }}-all --print --progress plain | jq ".target[].tags | join(\" \")" -r > "/tmp/tags.log" |
| 101 | + cat "/tmp/tags.log" |
| 102 | + - name: Build and push ${{ matrix.php_version }}-${{ matrix.variant }} |
97 | 103 | run: |
|
98 | 104 | PHP_VERSION="${{ matrix.php_version }}"
|
99 |
| - PHP_PATCH_MINOR="${PHP_VERSION_MINOR}" \ |
| 105 | + PHP_PATCH_MINOR="${{ env.PHP_PATCH_MINOR }}" \ |
| 106 | + TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ |
| 107 | + IS_RELEASE="1" \ |
100 | 108 | docker buildx bake \
|
101 | 109 | --set "*.platform=linux/amd64,linux/arm64" \
|
102 | 110 | --set "*.output=type=registry" \
|
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" |
106 | 111 | php${PHP_VERSION//.}-${{ matrix.variant }}-all
|
107 |
| - - name: Display tags built |
108 |
| - run: | |
109 |
| - echo "With prefix :" > "/tmp/tags.log" |
110 |
| - TAG_PREFIX="rc${GITHUB_SHA::7}-" \ |
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" |
114 |
| - PHP_PATCH_MINOR="${PHP_VERSION_MINOR}" \ |
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 |
| 112 | + - name: Push artifacts |
118 | 113 | uses: actions/upload-artifact@v3
|
119 | 114 | with:
|
120 |
| - name: ${{ matrix.php_version }}-${{ matrix.variant }}-logs |
121 |
| - path: /tmp/{digests,tag}.log |
| 115 | + name: ${{ matrix.php_version }}-${{ matrix.variant }} |
| 116 | + path: /tmp/tags.log |
122 | 117 | retention-days: 60
|
0 commit comments