Skip to content

Commit e390b5a

Browse files
committed
Better output
1 parent 957181b commit e390b5a

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

.github/workflows/ghcr.yml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ jobs:
132132
133133
build:
134134
needs: parse
135+
name: Build (${{ matrix.directory }})
135136
runs-on: ubuntu-latest
136137
permissions:
137138
contents: read
@@ -162,40 +163,38 @@ jobs:
162163
shell: bash
163164
run: |
164165
set -e
165-
166+
166167
DIRECTORY="${{ matrix.directory }}"
167168
PLATFORMS="${{ matrix.platforms }}"
168169
ALL_TAGS="${{ matrix.tags }}"
169170
IS_PR="${{ github.event_name == 'pull_request' }}"
170-
171+
171172
echo "=========================================="
172173
echo "Building image from: $DIRECTORY"
173174
echo "Platforms: $PLATFORMS"
174175
echo "Tags: $ALL_TAGS"
175176
echo "=========================================="
176-
177+
echo
178+
177179
# Build Docker tag arguments
178180
TAG_ARGS=""
179181
for tag in $ALL_TAGS; do
180182
TAG_ARGS="$TAG_ARGS --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$tag"
181183
done
182-
183-
# Build the image
184+
185+
# Construct buildx command string (print it for logs), then run it
184186
if [[ "$IS_PR" == "true" ]]; then
185-
echo "PR mode: Building without pushing..."
186-
docker buildx build \
187-
--platform "$PLATFORMS" \
188-
--file "$DIRECTORY/Dockerfile" \
189-
$TAG_ARGS \
190-
"$DIRECTORY"
187+
CMD="docker buildx build --platform '$PLATFORMS' --file '$DIRECTORY/Dockerfile' $TAG_ARGS '$DIRECTORY'"
191188
else
192-
echo "Master branch: Building and pushing..."
193-
docker buildx build \
194-
--platform "$PLATFORMS" \
195-
--file "$DIRECTORY/Dockerfile" \
196-
--push \
197-
$TAG_ARGS \
198-
"$DIRECTORY"
189+
CMD="docker buildx build --push --platform '$PLATFORMS' --file '$DIRECTORY/Dockerfile' $TAG_ARGS '$DIRECTORY'"
199190
fi
200-
191+
192+
echo "=========================================="
193+
echo "Running buildx command:"
194+
echo "$CMD"
195+
echo "=========================================="
196+
197+
# Execute the command
198+
eval $CMD
199+
201200
echo "Successfully processed $DIRECTORY"

0 commit comments

Comments
 (0)