1- name : Create and publish sqld binaried and Docker image
1+ name : ci
22
33on :
44 push :
5- branches : ['main']
5+ branches :
6+ - " main"
67 tags :
78 - libsql-server-v*.*.*
89
@@ -11,92 +12,164 @@ env:
1112 IMAGE_NAME : tursodatabase/libsql-server
1213
1314jobs :
14- # docker image build and upload to ghcr
15- build-and-push-image :
15+ build-amd64 :
16+ permissions : write-all
1617 runs-on : ubuntu-latest
17- permissions :
18- contents : read
19- packages : write
20-
18+ env :
19+ platform : " linux/amd64"
2120 steps :
22- - name : Checkout repository
23- uses : actions/checkout@v3
21+ -
22+ name : Prepare
23+ run : |
24+ platform=${{ env.platform }}
25+ echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
26+ -
27+ name : Checkout
28+ uses : actions/checkout@v4
29+ -
30+ name : Docker meta
31+ id : meta
32+ uses : docker/metadata-action@v5
2433 with :
25- submodules : recursive
26-
27- - name : Set up Docker Buildx
34+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
35+ tags : |
36+ type=match,pattern=libsql-server-(.*),group=1
37+ type=raw,value=latest
38+ -
39+ name : Set up QEMU
40+ uses : docker/setup-qemu-action@v3
41+ -
42+ name : Set up Docker Buildx
2843 uses : docker/setup-buildx-action@v3
29- with :
30- platforms : linux/amd64,linux/arm64
31-
32- - name : Log in to the Container registry
33- uses : docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
44+ -
45+ name : Login to Docker Hub
46+ uses : docker/login-action@v3
3447 with :
3548 registry : ${{ env.REGISTRY }}
3649 username : ${{ github.actor }}
3750 password : ${{ secrets.GITHUB_TOKEN }}
51+ -
52+ name : Build and push by digest
53+ id : build
54+ uses : docker/build-push-action@v5
55+ with :
56+ context : .
57+ platforms : ${{ env.platform }}
58+ labels : ${{ steps.meta.outputs.labels }}
59+ outputs : type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
60+ -
61+ name : Export digest
62+ run : |
63+ mkdir -p /tmp/digests
64+ digest="${{ steps.build.outputs.digest }}"
65+ touch "/tmp/digests/${digest#sha256:}"
66+ -
67+ name : Upload digest
68+ uses : actions/upload-artifact@v4
69+ with :
70+ name : digests-${{ env.PLATFORM_PAIR }}
71+ path : /tmp/digests/*
72+ if-no-files-found : error
73+ retention-days : 1
3874
39- - name : Extract metadata (tags, labels) for Docker
75+ build-arm64 :
76+ permissions : write-all
77+ runs-on : buildjet-4vcpu-ubuntu-2204-arm
78+ env :
79+ platform : " linux/arm64"
80+ steps :
81+ -
82+ name : Prepare
83+ run : |
84+ platform=${{ env.platform }}
85+ echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
86+ -
87+ name : Checkout
88+ uses : actions/checkout@v4
89+ -
90+ name : Docker meta
4091 id : meta
41- uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
92+ uses : docker/metadata-action@v5
4293 with :
4394 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4495 tags : |
4596 type=match,pattern=libsql-server-(.*),group=1
4697 type=raw,value=latest
47-
48- - name : Build and push Docker image
49- uses : docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
98+ -
99+ name : Set up QEMU
100+ uses : docker/setup-qemu-action@v3
101+ -
102+ name : Set up Docker Buildx
103+ uses : docker/setup-buildx-action@v3
104+ -
105+ name : Login to Docker Hub
106+ uses : docker/login-action@v3
107+ with :
108+ registry : ${{ env.REGISTRY }}
109+ username : ${{ github.actor }}
110+ password : ${{ secrets.GITHUB_TOKEN }}
111+ -
112+ name : Build and push by digest
113+ id : build
114+ uses : docker/build-push-action@v5
50115 with :
51116 context : .
52- platforms : linux/amd64
53- push : true
54- tags : ${{ steps.meta.outputs.tags }}
117+ platforms : ${{ env.platform }}
55118 labels : ${{ steps.meta.outputs.labels }}
56- cache-from : type=gha
57- cache-to : type=gha,mode=max
119+ outputs : type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
120+ -
121+ name : Export digestmatrix
122+ run : |
123+ mkdir -p /tmp/digests
124+ digest="${{ steps.build.outputs.digest }}"
125+ touch "/tmp/digests/${digest#sha256:}"
126+ -
127+ name : Upload digest
128+ uses : actions/upload-artifact@v4
129+ with :
130+ name : digests-${{ env.PLATFORM_PAIR }}
131+ path : /tmp/digests/*
132+ if-no-files-found : error
133+ retention-days : 1
58134
59- build-and-push-image-arm :
60- runs-on : ubuntu-latest
61- permissions :
62- contents : read
63- packages : write
64135
136+ merge :
137+ permissions : write-all
138+ runs-on : ubuntu-latest
139+ needs :
140+ - build-amd64
141+ - build-arm64
65142 steps :
66- - name : Checkout repository
67- uses : actions/checkout@v3
143+ -
144+ name : Download digests
145+ uses : actions/download-artifact@v4
68146 with :
69- submodules : recursive
70-
71- - name : Set up Docker Buildx
147+ path : /tmp/digests
148+ pattern : digests-*
149+ merge-multiple : true
150+ -
151+ name : Set up Docker Buildx
72152 uses : docker/setup-buildx-action@v3
153+ -
154+ name : Docker meta
155+ id : meta
156+ uses : docker/metadata-action@v5
73157 with :
74- platforms : linux/arm64
75-
76- - name : Log in to the Container registry
77- uses : docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
158+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
159+ -
160+ name : Login to Docker Hub
161+ uses : docker/login-action@v3
78162 with :
79163 registry : ${{ env.REGISTRY }}
80164 username : ${{ github.actor }}
81165 password : ${{ secrets.GITHUB_TOKEN }}
82-
83- - name : Extract metadata (tags, labels) for Docker
84- id : meta
85- uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
86- with :
87- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
88- tags : |
89- type=match,pattern=libsql-server-(.*),group=1
90- type=raw,value=latest-arm
91-
92- - name : Build and push Docker image
93- uses : docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
94- with :
95- context : .
96- platforms : linux/arm64
97- push : true
98- tags : ${{ steps.meta.outputs.tags }}
99- labels : ${{ steps.meta.outputs.labels }}
100- cache-from : type=gha
101- cache-to : type=gha,mode=max
102-
166+ -
167+ name : Create manifest list and push
168+ working-directory : /tmp/digests
169+ run : |
170+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
171+ $(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
172+ -
173+ name : Inspect image
174+ run : |
175+ docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
0 commit comments