chore: staging tweaks (#2277) #795
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: Docker CI Multi-Platform | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
permissions: | |
contents: read | |
jobs: | |
settings: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{steps.env.outputs.version}} | |
short_sha: ${{steps.env.outputs.short_sha}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup outputs | |
id: env | |
run: | | |
echo "version=$(cat ./VERSION)" >> "$GITHUB_OUTPUT" | |
echo "short_sha=$(git rev-parse --short=7 HEAD)" >> "$GITHUB_OUTPUT" | |
build: | |
needs: settings | |
strategy: | |
matrix: | |
include: | |
- runner: [self-hosted, X64] | |
arch: amd64 | |
- runner: arm-runner | |
arch: arm64 | |
runs-on: ${{ matrix.runner }} | |
timeout-minutes: 120 | |
steps: | |
# checkout git commit | |
- uses: actions/checkout@v3 | |
# Setup docker | |
# https://github.com/supabase/postgres/blob/develop/.github/workflows/dockerhub-release.yml#LL41C11-L42C44 | |
- run: docker context create builders | |
- uses: docker/setup-buildx-action@v2 | |
with: | |
endpoint: builders | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Build and push | |
- id: build | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: supabase/logflare:dev-${{ needs.settings.outputs.short_sha }}-${{ matrix.arch }} | |
platforms: linux/${{ matrix.arch }} | |
# caching | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
merge_publish: | |
needs: | |
- settings | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Setup tags | |
run: | | |
echo "tag_amd64=supabase/logflare:dev-${{ needs.settings.outputs.short_sha }}-amd64" >> "$GITHUB_ENV" | |
echo "tag_arm64=supabase/logflare:dev-${{ needs.settings.outputs.short_sha }}-arm64" >> "$GITHUB_ENV" | |
echo "tag_sha=supabase/logflare:dev-${{ needs.settings.outputs.short_sha }}" >> "$GITHUB_ENV" | |
- name: Staging - Merge multi-arch manifests and push the dev image | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
run: | | |
docker buildx imagetools create -t ${{ env.tag_sha }} \ | |
${{ env.tag_amd64 }} ${{ env.tag_arm64 }} | |
trigger_cloudbuild: | |
uses: ./.github/workflows/trigger-cloudbuild.yml | |
needs: | |
- settings | |
- build | |
- merge_publish | |
secrets: inherit |