Skip to content

Commit 7a81207

Browse files
author
Felipe Almeida Baccaro
committed
moving commands to versioning.sh.
1 parent 96ea239 commit 7a81207

3 files changed

Lines changed: 22 additions & 16 deletions

File tree

‎.github/workflows/docker-image.yml‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,7 @@ jobs:
1515
password: ${{ secrets.DOCKERHUB_TOKEN }}
1616
- name: Checkout code
1717
uses: actions/checkout@v4
18-
- name: "Build images"
18+
- name: "Build and Push"
1919
run: |
20-
buildExpr='map(select(.build == true)).[] | .stages[] as $stage | "docker build --no-cache --target \($stage) -t \(.namespace)/\(.name):\(.tag)-\($stage|ascii_downcase) ./\(.path)" | split("\n") | .[]';
21-
jq -r "$buildExpr" versions.json | while read -r image; do
22-
$($image)
23-
done
24-
- name: "Push Images"
25-
run: |
26-
pushExpr='map(select(.build == true and .push == true)).[] | .stages[] as $stage | "docker push \(.namespace)/\(.name):\(.tag)-\($stage|ascii_downcase) " | split("\n") | .[]'
27-
jq -r "$pushExpr" versions.json | while read -r image; do
28-
$($image)
29-
done
30-
20+
chmod +x ./versioning.sh
21+
./versioning.sh

‎versioning.sh‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
jq -r 'map(select(.build == true)).[]
4+
| .stages[] as $stage
5+
| "docker build --no-cache --target \($stage) -t \(.namespace)/\(.repository):\(.tag)-\($stage|ascii_downcase) ./\(.path) "
6+
| split("\n") | .[]' versions.json | while read -r image; do
7+
$("$image")
8+
done
9+
10+
jq -r 'map(select(.build == true and .push == true)).[]
11+
| .stages[] as $stage
12+
| "docker push \(.namespace)/\(.repository):\(.tag)-\($stage|ascii_downcase)"
13+
| split("\n") | .[]' versions.json | while read -r image; do
14+
$("$image")
15+
done

‎versions.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"namespace": "wiredupdev",
4-
"name": "php-cli-8.3-alpine",
4+
"repository": "php-cli-8.3-alpine",
55
"path": "8.3-alpine/cli",
66
"tag": "2026.1.1",
77
"stages": ["dev"],
@@ -10,7 +10,7 @@
1010
},
1111
{
1212
"namespace": "wiredupdev",
13-
"name": "php-fpm-8.3-alpine",
13+
"repository": "php-fpm-8.3-alpine",
1414
"path": "8.3-alpine/fpm",
1515
"tag": "2026.1.1",
1616
"stages": ["dev", "prod"],
@@ -19,7 +19,7 @@
1919
},
2020
{
2121
"namespace": "wiredupdev",
22-
"name": "php-cli-8.4-alpine",
22+
"repository": "php-cli-8.4-alpine",
2323
"path": "8.4-alpine/cli",
2424
"tag": "2026.1.1",
2525
"stages": ["dev", "prod"],
@@ -28,7 +28,7 @@
2828
},
2929
{
3030
"namespace": "wiredupdev",
31-
"name": "php-fpm-8.4-alpine",
31+
"repository": "php-fpm-8.4-alpine",
3232
"path": "8.4-alpine/fpm",
3333
"tag": "2026.1.1",
3434
"stages": ["dev", "prod"],

0 commit comments

Comments
 (0)