Manual Docker Artifacts Release #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Manual Docker Artifacts Release | |
on: | |
workflow_dispatch: | |
inputs: | |
postgresVersion: | |
description: 'Postgres version to publish, i.e. 15.1.1.78' | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
build_args: ${{ steps.args.outputs.result }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- id: args | |
run: | | |
nix run nixpkgs#nushell -- -c ' | |
open ansible/vars.yml | |
| items { |key value| {name: $key, item: $value} } | |
| where { |it| ($it.item | describe) == "string" } | |
| each { |it| $"($it.name)=($it.item)" } | |
| str join "\n" | |
| save --append $env.GITHUB_OUTPUT | |
' | |
build_release_image: | |
needs: build | |
strategy: | |
matrix: | |
arch: [amd64, arm64] | |
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-runner' }} | |
timeout-minutes: 180 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- run: docker context create builders | |
- uses: docker/setup-buildx-action@v3 | |
with: | |
endpoint: builders | |
- uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Get image tag | |
id: image | |
run: | | |
echo "pg_version=supabase/postgres:${{ inputs.postgresVersion }}" >> $GITHUB_OUTPUT | |
- id: build | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
build-args: | | |
${{ needs.build.outputs.build_args }} | |
target: production | |
tags: ${{ steps.image.outputs.pg_version }}_${{ matrix.arch }} | |
platforms: linux/${{ matrix.arch }} | |
cache-from: type=gha,scope=${{ github.ref_name }}-latest-${{ matrix.arch }} | |
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-latest-${{ matrix.arch }} | |
file: Dockerfile-${{ matrix.arch }} | |
merge_manifest: | |
needs: build_release_image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Merge multi-arch manifests | |
run: | | |
docker buildx imagetools create -t supabase/postgres:${{ inputs.postgresVersion }} \ | |
supabase/postgres:${{ inputs.postgresVersion }}_amd64 \ | |
supabase/postgres:${{ inputs.postgresVersion }}_arm64 | |
publish: | |
needs: merge_manifest | |
uses: ./.github/workflows/mirror.yml | |
with: | |
version: ${{ inputs.postgresVersion }} | |
secrets: inherit |