Skip to content

Commit 9fd841f

Browse files
committed
refactor: simplify platform selection
1 parent c598772 commit 9fd841f

File tree

2 files changed

+7
-30
lines changed

2 files changed

+7
-30
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ on:
2323
description: Platforms to build
2424
default: multiplatform
2525
options:
26-
- multiplatform
27-
- amd64
28-
- arm64
26+
- linux/amd64,linux/arm64
27+
- linux/amd64
28+
- linux/arm64
2929
pull_request:
3030
branches:
3131
- main
@@ -41,29 +41,6 @@ jobs:
4141
- name: Checkout
4242
uses: actions/checkout@v4
4343

44-
- name: Determine platforms to build
45-
id: determine_platforms
46-
run: |
47-
case "${{ inputs.platforms }}" in
48-
amd64)
49-
echo "Building for amd64"
50-
PLATFORMS="linux/amd64"
51-
;;
52-
arm64)
53-
echo "Building for arm64"
54-
PLATFORMS="linux/arm64"
55-
;;
56-
multiplatform | "")
57-
echo "Building for multiplatform"
58-
PLATFORMS="linux/amd64,linux/arm64"
59-
;;
60-
*)
61-
echo "Invalid platform"
62-
exit 1
63-
;;
64-
esac
65-
echo "platforms=${PLATFORMS}" >> $GITHUB_OUTPUT
66-
6744
- name: Login to Docker
6845
uses: docker/login-action@v3
6946
with:
@@ -91,7 +68,7 @@ jobs:
9168
uses: docker/build-push-action@v5
9269
with:
9370
context: .
94-
platforms: ${{ steps.determine_platforms.outputs.platforms }}
71+
platforms: ${{ inputs.platforms || 'linux/amd64,linux/arm64' }}
9572
push: true
9673
tags: ${{ vars.DOCKER_HUB_ACCOUNT }}/dbc-demo:latest
9774
cache-from: type=gha
@@ -102,6 +79,6 @@ jobs:
10279
uses: docker/build-push-action@v5
10380
with:
10481
context: .
105-
platforms: ${{ steps.determine_platforms.outputs.platforms }}
82+
platforms: ${{ inputs.platforms || 'linux/amd64,linux/arm64' }}
10683
push: true
10784
tags: ${{ vars.DOCKER_HUB_ACCOUNT }}/dbc-demo:latest

.github/workflows/compare.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ jobs:
88
secrets: inherit
99
with:
1010
builder_type: local
11-
platforms: multiplatform
11+
platforms: linux/amd64,linux/arm64
1212

1313
build_cloud:
1414
uses: ./.github/workflows/ci.yaml
1515
secrets: inherit
1616
with:
1717
builder_type: cloud
18-
platforms: multiplatform
18+
platforms: linux/amd64,linux/arm64
1919

0 commit comments

Comments
 (0)