@@ -2,13 +2,30 @@ name: AppFlowy Web image build and push
2
2
on :
3
3
workflow_dispatch :
4
4
inputs :
5
- appflowy_web_version :
5
+ version :
6
6
description : ' AppFlowy Web version'
7
7
required : true
8
+ env :
9
+ DOCKERHUB_REPO : appflowyinc/appflowy_web
8
10
jobs :
9
- appflowy_web_image :
10
- runs-on : ubuntu-22.04
11
+ build :
12
+ runs-on : ${{ matrix.os }}
13
+ strategy :
14
+ matrix :
15
+ include :
16
+ - os : ubuntu-24.04
17
+ platform : linux/amd64
18
+ - os : ubuntu-24.04-arm
19
+ platform : linux/arm64
11
20
steps :
21
+ - name : Prepare
22
+ run : |
23
+ PLATFORM=${{ matrix.platform }}
24
+ VERSION=${{ github.event.inputs.version }}
25
+ IMAGE_TAG=${VERSION#v}
26
+ echo "PLATFORM_PAIR=${PLATFORM//\//-}" >> $GITHUB_ENV
27
+ echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
28
+
12
29
- name : Check out the repository
13
30
uses : actions/checkout@v3
14
31
with :
@@ -17,17 +34,61 @@ jobs:
17
34
- name : Set up QEMU
18
35
uses : docker/setup-qemu-action@v3
19
36
20
- - name : Set up Docker Buildx
21
- uses : docker/setup-buildx-action@v3
22
-
23
37
- name : Log in to Docker Hub
24
38
uses : docker/login-action@v3
25
39
with :
26
40
username : ${{ secrets.DOCKER_HUB_USERNAME }}
27
41
password : ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
28
42
29
- - name : Build AppFlowy Web
43
+ - name : Set up Docker Buildx
44
+ uses : docker/setup-buildx-action@v3
45
+
46
+ - name : Build and push by digest
47
+ id : build
48
+ uses : docker/build-push-action@v6
49
+ with :
50
+ platforms : ${{ matrix.platform }}
51
+ tags : ${{ env.IMAGE_TAG }},latest
52
+ build-args : VERSION=${{ github.event.inputs.version }}
53
+ context : docker/web
54
+ outputs : type=image,name=${{ env.DOCKERHUB_REPO }},push-by-digest=true,name-canonical=true,push=true
55
+
56
+ - name : Export digest
57
+ run : |
58
+ mkdir -p ${{ runner.temp }}/digests
59
+ digest="${{ steps.build.outputs.digest }}"
60
+ touch "${{ runner.temp }}/digests/${digest#sha256:}"
61
+
62
+ - name : Upload digest
63
+ uses : actions/upload-artifact@v4
64
+ with :
65
+ name : digests-${{ env.PLATFORM_PAIR }}
66
+ path : ${{ runner.temp }}/digests/*
67
+ if-no-files-found : error
68
+ retention-days : 1
69
+ merge :
70
+ runs-on : ubuntu-24.04
71
+ needs :
72
+ - build
73
+ steps :
74
+ - name : Download digests
75
+ uses : actions/download-artifact@v4
76
+ with :
77
+ path : ${{ runner.temp }}/digests
78
+ pattern : digests-*
79
+ merge-multiple : true
80
+
81
+ - name : Login to Docker Hub
82
+ uses : docker/login-action@v3
83
+ with :
84
+ username : ${{ vars.DOCKERHUB_USERNAME }}
85
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
86
+
87
+ - name : Set up Docker Buildx
88
+ uses : docker/setup-buildx-action@v3
89
+
90
+ - name : Create manifest list and push
91
+ working-directory : ${{ runner.temp }}/digests
30
92
run : |
31
- export VERSION=${{ github.event.inputs.appflowy_web_version }}
32
- export TAG=${VERSION#v}
33
- docker buildx build --build-arg VERSION=${VERSION} --platform linux/amd64,linux/arm64 -t appflowyinc/appflowy-web:${TAG} -t appflowyinc/appflowy-web:latest -f docker/web/Dockerfile docker/web
93
+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
94
+ $(printf '${{ env.DOCKERHUB_REPO }}@sha256:%s ' *)
0 commit comments