Skip to content

Commit 1959baa

Browse files
committed
Hotfix deploy
1 parent 8485387 commit 1959baa

File tree

3 files changed

+34
-35
lines changed

3 files changed

+34
-35
lines changed

.github/workflows/workflow.yml

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Build
3737
run: |
3838
PHP_VERSION="${{ matrix.php_version }}"
39-
TAG_PREFIX="rc${GITHUB_SHA::7}-" \
39+
TAG_PREFIX="rc${GITHUB_RUN_ID}-" \
4040
docker buildx bake \
4141
--set "*.platform=linux/${{ matrix.builder.arch }}" \
4242
--set "*.output=type=docker" \
@@ -47,7 +47,7 @@ jobs:
4747
docker image ls --filter="reference=thecodingmachine/php" --format "{{.CreatedAt}}\t{{.Size}}\t{{.Repository}}:{{.Tag}}"
4848
- name: Test
4949
run: |
50-
TAG_PREFIX="rc${GITHUB_SHA::7}-" \
50+
TAG_PREFIX="rc${GITHUB_RUN_ID}-" \
5151
PHP_VERSION="${{ matrix.php_version }}" \
5252
BRANCH="v4" \
5353
VARIANT="${{ matrix.variant }}" \
@@ -78,45 +78,40 @@ jobs:
7878
with:
7979
username: ${{ secrets.DOCKERHUB_USERNAME }}
8080
password: ${{ secrets.DOCKERHUB_TOKEN }}
81-
- name: Build and push ${{ matrix.php_version }}-${{ matrix.variant }} with tagged prefix
81+
- name: Fetch minor version of php
8282
run: |
83+
# Build slim one
8384
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}-" \
8686
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`
9593
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 }}
97103
run: |
98104
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" \
100108
docker buildx bake \
101109
--set "*.platform=linux/amd64,linux/arm64" \
102110
--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"
106111
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
118113
uses: actions/upload-artifact@v3
119114
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
122117
retention-days: 60

docker-bake.hcl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,15 @@ group "php72" {
137137
variable "REPO" {default = "thecodingmachine/php"}
138138
variable "TAG_PREFIX" {default = ""}
139139
variable "PHP_PATCH_MINOR" {default = ""}
140+
variable "IS_RELEASE" {default = "0"}
140141
variable "GLOBAL_VERSION" {default = "v4"}
141142

142143
function "tag" {
143144
params = [PHP_VERSION, VARIANT]
144145
result = [
145-
"${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-${VARIANT}",
146-
notequal("",PHP_PATCH_MINOR) ? "${REPO}:${TAG_PREFIX}${PHP_PATCH_MINOR}-${GLOBAL_VERSION}-${VARIANT}": "",
146+
equal("1",IS_RELEASE) ? "${REPO}:${PHP_VERSION}-${GLOBAL_VERSION}-${VARIANT}" : "",
147+
equal("1",IS_RELEASE) ? (notequal("",PHP_PATCH_MINOR) ? "${REPO}:${PHP_PATCH_MINOR}-${GLOBAL_VERSION}-${VARIANT}": "") : "",
148+
"${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-${VARIANT}",
147149
]
148150
}
149151

utils/docker-bake.blueprint.hcl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ group "php{{ $phpV | replace "." "" }}" {
2222
variable "REPO" {default = "thecodingmachine/php"}
2323
variable "TAG_PREFIX" {default = ""}
2424
variable "PHP_PATCH_MINOR" {default = ""}
25+
variable "IS_RELEASE" {default = "0"}
2526
variable "GLOBAL_VERSION" {default = "v4"}
2627

2728
function "tag" {
2829
params = [PHP_VERSION, VARIANT]
2930
result = [
30-
"${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-${VARIANT}",
31-
notequal("",PHP_PATCH_MINOR) ? "${REPO}:${TAG_PREFIX}${PHP_PATCH_MINOR}-${GLOBAL_VERSION}-${VARIANT}": "",
31+
equal("1",IS_RELEASE) ? "${REPO}:${PHP_VERSION}-${GLOBAL_VERSION}-${VARIANT}" : "",
32+
equal("1",IS_RELEASE) ? (notequal("",PHP_PATCH_MINOR) ? "${REPO}:${PHP_PATCH_MINOR}-${GLOBAL_VERSION}-${VARIANT}": "") : "",
33+
"${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-${VARIANT}",
3234
]
3335
}
3436

0 commit comments

Comments
 (0)