Skip to content

Commit

Permalink
use buildjet
Browse files Browse the repository at this point in the history
  • Loading branch information
LucioFranco committed Feb 27, 2024
1 parent 5c55562 commit 4cfe8ea
Showing 1 changed file with 68 additions and 10 deletions.
78 changes: 68 additions & 10 deletions .github/workflows/publish-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@ env:
IMAGE_NAME: tursodatabase/libsql-server

jobs:
build:
build-amd64:
permissions: write-all
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
env:
platform: "linux/amd64"
steps:
-
name: Prepare
run: |
platform=${{ matrix.platform }}
platform=${{ env.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
-
name: Checkout
Expand Down Expand Up @@ -58,7 +54,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platform }}
platforms: ${{ env.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
-
Expand All @@ -76,11 +72,73 @@ jobs:
if-no-files-found: error
retention-days: 1

build-arm64:
permissions: write-all
runs-on: buildjet-4vcpu-ubuntu-2204-arm
env:
platform: "linux/arm64"
steps:
-
name: Prepare
run: |
platform=${{ env.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
-
name: Checkout
uses: actions/checkout@v4
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=match,pattern=libsql-server-(.*),group=1
type=raw,value=latest
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ env.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
-
name: Export digestmatrix
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
-
name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1


merge:
permissions: write-all
runs-on: ubuntu-latest
needs:
- build
- build-amd64
- build-arm64
steps:
-
name: Download digests
Expand Down

0 comments on commit 4cfe8ea

Please sign in to comment.