Skip to content

Commit

Permalink
chore: handling architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
samrose committed Dec 19, 2024
1 parent 9df7187 commit 47e3258
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
34 changes: 19 additions & 15 deletions .github/workflows/dockerhub-release-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ jobs:
supabase/postgres:${{ steps.get_version.outputs.pg_version }}_arm64
get_publish_version:
needs: [prepare, merge_manifest]
strategy:
matrix:
include: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.get_versions.outputs.matrix }}
Expand All @@ -169,25 +166,32 @@ jobs:
id: get_versions
run: |
nix run nixpkgs#nushell -- -c '
let versions = "${{ matrix.version }}"
let release_key = if ($versions | str contains "orioledb") {
$"postgresorioledb-17"
} else {
$"postgres($versions)"
}
let pg_version = (open ansible/vars.yml | get postgres_release | get $release_key | str trim)
let matrix = {include: [{version: $pg_version}]}
let original_matrix = ($env.GITHUB_WORKFLOW_REF | split row "@" | get 0 | from json)
let versions = $original_matrix.include
let processed_versions = ($versions | each { |item|
let version = $item.version
let release_key = if ($version | str contains "orioledb") {
$"postgresorioledb-17"
} else {
$"postgres($version)"
}
let pg_version = (open ansible/vars.yml | get postgres_release | get $release_key | str trim)
# Include both AMD64 and ARM64 architectures
[{version: $pg_version, arch: "amd64"}, {version: $pg_version, arch: "arm64"}]
} | flatten)
let matrix = {include: $processed_versions}
let matrix_json = ($matrix | to json -r)
$"matrix=($matrix_json)" | save --append $env.GITHUB_OUTPUT
'
publish:
needs: get_publish_version
strategy:
matrix:
include: ${{ fromJson(needs.get_publish_version.outputs.matrix).include }}
matrix: ${{ fromJson(needs.get_publish_version.outputs.matrix) }}
uses: ./.github/workflows/mirror.yml
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
secrets: inherit
13 changes: 10 additions & 3 deletions .github/workflows/mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ on:
version:
required: true
type: string
arch:
required: true
type: string
workflow_dispatch:
inputs:
version:
description: "Image tag"
required: true
type: string
arch:
description: "Architecture"
required: true
type: string

jobs:
mirror:
Expand All @@ -36,7 +43,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- uses: akhilerm/[email protected]
with:
src: docker.io/supabase/postgres:${{ inputs.version }}
src: docker.io/supabase/postgres:${{ inputs.version }}_${{ inputs.arch }}
dst: |
public.ecr.aws/supabase/postgres:${{ inputs.version }}
ghcr.io/supabase/postgres:${{ inputs.version }}
public.ecr.aws/supabase/postgres:${{ inputs.version }}_${{ inputs.arch }}
ghcr.io/supabase/postgres:${{ inputs.version }}_${{ inputs.arch }}

0 comments on commit 47e3258

Please sign in to comment.