Skip to content

Commit 0f6bb71

Browse files
committed
feat/ci: Add main branch build matrix
Signed-off-by: SeeuSim <[email protected]>
1 parent 1c2cc11 commit 0f6bb71

File tree

1 file changed

+55
-35
lines changed

1 file changed

+55
-35
lines changed

.github/workflows/build-docker.yaml

Lines changed: 55 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -46,49 +46,69 @@ jobs:
4646
run: |
4747
matrix=()
4848
if [[ "${{ steps.filter.outputs.user }}" == "true" || "${{ contains(github.ref, 'main') }}" == "true" ]]; then
49-
matrix+=("{
50-
\"package\": \"user\",
51-
\"image\": \"$DOCKER_REGISTRY_USN/user-express\",
52-
\"context\": \"./backend/user\",
53-
\"dockerfile\": \"./backend/user/express.Dockerfile\",
54-
\"build-args\": \"port=$USER_EXPRESS_PORT\"
55-
}")
49+
config=$(cat <<EOF
50+
{
51+
"package": "user",
52+
"image": "$DOCKER_REGISTRY_USN/user-express",
53+
"context": "./backend/user",
54+
"dockerfile": "./backend/user/express.Dockerfile",
55+
"build-args": "port=$USER_EXPRESS_PORT"
56+
}
57+
EOF
58+
)
59+
matrix+=("$config")
5660
fi
5761
if [[ "${{ steps.filter.outputs.question }}" == "true" || "${{ contains(github.ref, 'main') }}" == "true" ]]; then
58-
matrix+=("{
59-
\"package\": \"question\",
60-
\"image\": \"$DOCKER_REGISTRY_USN/question-express\",
61-
\"context\": \"./backend/question\",
62-
\"dockerfile\": \"./backend/question/express.Dockerfile\",
63-
\"build-args\": \"port=$QUESTION_EXPRESS_PORT\"
64-
}")
62+
config=$(cat <<EOF
63+
{
64+
"package": "question",
65+
"image": "$DOCKER_REGISTRY_USN/question-express",
66+
"context": "./backend/question",
67+
"dockerfile": "./backend/question/express.Dockerfile",
68+
"build-args": "port=$QUESTION_EXPRESS_PORT"
69+
}
70+
EOF
71+
)
72+
matrix+=("$config")
6573
fi
6674
if [[ "${{ steps.filter.outputs.collaboration }}" == "true" || "${{ contains(github.ref, 'main') }}" == "true" ]]; then
67-
matrix+=("{
68-
\"package\": \"collaboration\",
69-
\"image\": \"$DOCKER_REGISTRY_USN/collab-express\",
70-
\"context\": \"./backend/collaboration\",
71-
\"dockerfile\": \"./backend/collaboration/express.Dockerfile\",
72-
\"build-args\": \"port=$COLLAB_EXPRESS_PORT\"
73-
}")
75+
config=$(cat <<EOF
76+
{
77+
"package": "collaboration",
78+
"image": "$DOCKER_REGISTRY_USN/collab-express",
79+
"context": "./backend/collaboration",
80+
"dockerfile": "./backend/collaboration/express.Dockerfile",
81+
"build-args": "port=$COLLAB_EXPRESS_PORT"
82+
}
83+
EOF
84+
)
85+
matrix+=("$config")
7486
fi
7587
if [[ "${{ steps.filter.outputs.matching }}" == "true" || "${{ contains(github.ref, 'main') }}" == "true" ]]; then
76-
matrix+=("{
77-
\"package\": \"matching\",
78-
\"image\": \"$DOCKER_REGISTRY_USN/match-express\",
79-
\"context\": \"./backend/matching\",
80-
\"dockerfile\": \"./backend/matching/express.Dockerfile\",
81-
\"build-args\": \"port=$MATCH_EXPRESS_PORT\"
82-
}")
88+
config=$(cat <<EOF
89+
{
90+
"package": "matching",
91+
"image": "$DOCKER_REGISTRY_USN/match-express",
92+
"context": "./backend/matching",
93+
"dockerfile": "./backend/matching/express.Dockerfile",
94+
"build-args": "port=$MATCH_EXPRESS_PORT"
95+
}
96+
EOF
97+
)
98+
matrix+=("$config")
8399
fi
84100
if [[ "${{ steps.filter.outputs.frontend }}" == "true" || "${{ contains(github.ref, 'main') }}" == "true" ]]; then
85-
matrix+=("{
86-
\"package\": \"frontend\",
87-
\"image\": \"$DOCKER_REGISTRY_USN/frontend\",
88-
\"context\": \"./frontend\",
89-
\"dockerfile\": \"./frontend/frontend.Dockerfile\",
90-
\"build-args\": \"port=$FRONTEND_PORT\"
91-
}")
101+
config=$(cat <<EOF
102+
{
103+
"package": "frontend",
104+
"image": "$DOCKER_REGISTRY_USN/frontend",
105+
"context": "./frontend",
106+
"dockerfile": "./frontend/frontend.Dockerfile",
107+
"build-args": "port=$FRONTEND_PORT"
108+
}
109+
EOF
110+
)
111+
matrix+=("$config")
92112
fi
93113
formatted_matrix=$(echo "[${matrix[*]}]" | jq -c .)
94114
echo "Outputs Generated: $formatted_matrix"

0 commit comments

Comments
 (0)