Skip to content

Commit 47e3258

Browse files
committed
chore: handling architecture
1 parent 9df7187 commit 47e3258

File tree

2 files changed

+29
-18
lines changed

2 files changed

+29
-18
lines changed

.github/workflows/dockerhub-release-matrix.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@ jobs:
156156
supabase/postgres:${{ steps.get_version.outputs.pg_version }}_arm64
157157
get_publish_version:
158158
needs: [prepare, merge_manifest]
159-
strategy:
160-
matrix:
161-
include: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
162159
runs-on: ubuntu-latest
163160
outputs:
164161
matrix: ${{ steps.get_versions.outputs.matrix }}
@@ -169,25 +166,32 @@ jobs:
169166
id: get_versions
170167
run: |
171168
nix run nixpkgs#nushell -- -c '
172-
let versions = "${{ matrix.version }}"
173-
let release_key = if ($versions | str contains "orioledb") {
174-
$"postgresorioledb-17"
175-
} else {
176-
$"postgres($versions)"
177-
}
178-
let pg_version = (open ansible/vars.yml | get postgres_release | get $release_key | str trim)
179-
180-
let matrix = {include: [{version: $pg_version}]}
169+
let original_matrix = ($env.GITHUB_WORKFLOW_REF | split row "@" | get 0 | from json)
170+
let versions = $original_matrix.include
171+
let processed_versions = ($versions | each { |item|
172+
let version = $item.version
173+
let release_key = if ($version | str contains "orioledb") {
174+
$"postgresorioledb-17"
175+
} else {
176+
$"postgres($version)"
177+
}
178+
let pg_version = (open ansible/vars.yml | get postgres_release | get $release_key | str trim)
179+
180+
# Include both AMD64 and ARM64 architectures
181+
[{version: $pg_version, arch: "amd64"}, {version: $pg_version, arch: "arm64"}]
182+
} | flatten)
183+
184+
let matrix = {include: $processed_versions}
181185
let matrix_json = ($matrix | to json -r)
182186
$"matrix=($matrix_json)" | save --append $env.GITHUB_OUTPUT
183187
'
184-
188+
185189
publish:
186190
needs: get_publish_version
187191
strategy:
188-
matrix:
189-
include: ${{ fromJson(needs.get_publish_version.outputs.matrix).include }}
192+
matrix: ${{ fromJson(needs.get_publish_version.outputs.matrix) }}
190193
uses: ./.github/workflows/mirror.yml
191194
with:
192195
version: ${{ matrix.version }}
196+
arch: ${{ matrix.arch }}
193197
secrets: inherit

.github/workflows/mirror.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@ on:
66
version:
77
required: true
88
type: string
9+
arch:
10+
required: true
11+
type: string
912
workflow_dispatch:
1013
inputs:
1114
version:
1215
description: "Image tag"
1316
required: true
1417
type: string
18+
arch:
19+
description: "Architecture"
20+
required: true
21+
type: string
1522

1623
jobs:
1724
mirror:
@@ -36,7 +43,7 @@ jobs:
3643
password: ${{ secrets.GITHUB_TOKEN }}
3744
- uses: akhilerm/[email protected]
3845
with:
39-
src: docker.io/supabase/postgres:${{ inputs.version }}
46+
src: docker.io/supabase/postgres:${{ inputs.version }}_${{ inputs.arch }}
4047
dst: |
41-
public.ecr.aws/supabase/postgres:${{ inputs.version }}
42-
ghcr.io/supabase/postgres:${{ inputs.version }}
48+
public.ecr.aws/supabase/postgres:${{ inputs.version }}_${{ inputs.arch }}
49+
ghcr.io/supabase/postgres:${{ inputs.version }}_${{ inputs.arch }}

0 commit comments

Comments
 (0)