61
61
matrix : ${{ fromJson(needs.prepare.outputs.matrix_config) }}
62
62
runs-on : ubuntu-latest
63
63
outputs :
64
- image_tag : supabase/postgres:${{ steps.settings.outputs.postgres-version }}
64
+ versions : ${{ steps.output-versions.outputs.versions }}
65
+ image_tags : ${{ steps.output-versions.outputs.image_tags }}
65
66
build_args : ${{ steps.args.outputs.result }}
66
67
steps :
67
68
- uses : actions/checkout@v3
76
77
PG_VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres${{ matrix.version }}"]' ansible/vars.yml)
77
78
PG_VERSION=$(echo $PG_VERSION | tr -d '"') # Remove any surrounding quotes
78
79
echo 'postgres-version = "'$PG_VERSION'"' > common-nix.vars.pkr.hcl
79
- # Ensure there's a newline at the end of the file
80
80
echo "" >> common-nix.vars.pkr.hcl
81
81
82
82
- id : settings
@@ -87,19 +87,25 @@ jobs:
87
87
with :
88
88
cmd : yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' 'ansible/vars.yml'
89
89
90
+ - id : output-versions
91
+ run : |
92
+ # Create JSON arrays for versions and image tags
93
+ echo "versions=$(echo '${{ toJSON(matrix.version) }}')" >> $GITHUB_OUTPUT
94
+ echo "image_tags=$(echo 'supabase/postgres:${{ steps.settings.outputs.postgres-version }}')" >> $GITHUB_OUTPUT
95
+
90
96
build_release_image :
91
97
needs : [build]
92
98
strategy :
93
99
matrix :
100
+ version : ${{ fromJson(needs.build.outputs.versions) }}
101
+ image_tag : ${{ fromJson(needs.build.outputs.image_tags) }}
94
102
include :
95
- - runner : [self-hosted, X64]
96
- arch : amd64
97
- - runner : arm-runner
98
- arch : arm64
103
+ - arch : amd64
104
+ runner : [self-hosted, X64]
105
+ - arch : arm64
106
+ runner : arm-runner
99
107
runs-on : ${{ matrix.runner }}
100
108
timeout-minutes : 180
101
- outputs :
102
- image_digest : ${{ steps.build.outputs.digest }}
103
109
steps :
104
110
- run : docker context create builders
105
111
- uses : docker/setup-buildx-action@v3
@@ -116,11 +122,11 @@ jobs:
116
122
build-args : |
117
123
${{ needs.build.outputs.build_args }}
118
124
target : production
119
- tags : ${{ needs.build.outputs .image_tag }}_${{ matrix.arch }}
125
+ tags : ${{ matrix .image_tag }}_${{ matrix.arch }}
120
126
platforms : linux/${{ matrix.arch }}
121
127
cache-from : type=gha,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
122
128
cache-to : type=gha,mode=max,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
123
- file : ${{ matrix.dockerfile }}
129
+ file : Dockerfile- ${{ matrix.version }}
124
130
- name : Slack Notification
125
131
if : ${{ failure() }}
126
132
uses : rtCamp/action-slack-notify@v2
@@ -133,6 +139,9 @@ jobs:
133
139
134
140
merge_manifest :
135
141
needs : [build, build_release_image]
142
+ strategy :
143
+ matrix :
144
+ image_tag : ${{ fromJson(needs.build.outputs.image_tags) }}
136
145
runs-on : ubuntu-latest
137
146
steps :
138
147
- uses : docker/setup-buildx-action@v3
@@ -142,9 +151,9 @@ jobs:
142
151
password : ${{ secrets.DOCKER_PASSWORD }}
143
152
- name : Merge multi-arch manifests
144
153
run : |
145
- docker buildx imagetools create -t ${{ needs.build.outputs .image_tag }} \
146
- ${{ needs.build.outputs .image_tag }}_amd64 \
147
- ${{ needs.build.outputs .image_tag }}_arm64
154
+ docker buildx imagetools create -t ${{ matrix .image_tag }} \
155
+ ${{ matrix .image_tag }}_amd64 \
156
+ ${{ matrix .image_tag }}_arm64
148
157
- name : Slack Notification
149
158
if : ${{ failure() }}
150
159
uses : rtCamp/action-slack-notify@v2
@@ -160,4 +169,4 @@ jobs:
160
169
uses : ./.github/workflows/mirror.yml
161
170
with :
162
171
version : ${{ needs.build.outputs.docker_version }}
163
- secrets : inherit
172
+ secrets : inherit
0 commit comments