Skip to content

Commit 71d5fd6

Browse files
committed
chore: search ci
1 parent bbac5a1 commit 71d5fd6

2 files changed

Lines changed: 202 additions & 1 deletion

File tree

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
name: Self-Hosted AppFlowy Search Docker Image
2+
run-name: Build AppFlowy Search ${{ github.event.inputs.custom_tag }} - Push ${{ github.event.inputs.push_appflowy_search == 'true' && '🔍' || '' }} ${{ github.event.inputs.tag_latest == 'true' && 'latest' || '' }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
appflowy_cloud_branch:
8+
description: "AppFlowy Cloud branch (from AppFlowy-Cloud-Premium)"
9+
required: true
10+
default: "main"
11+
custom_tag:
12+
description: "Custom tag to use. Example: 0.9.8"
13+
required: true
14+
default: ""
15+
push_appflowy_search:
16+
description: "Push AppFlowy Search image to registry"
17+
type: boolean
18+
required: false
19+
default: false
20+
build_arm64:
21+
description: "Also build ARM64 images (AMD64 always built)"
22+
type: boolean
23+
required: false
24+
default: true
25+
tag_latest:
26+
description: "Also tag and publish 'latest'"
27+
type: boolean
28+
required: false
29+
default: true
30+
31+
env:
32+
LATEST_TAG: latest
33+
RUST_TOOLCHAIN: "1.86.0"
34+
SQLX_OFFLINE: true
35+
36+
jobs:
37+
appflowy_search_image:
38+
runs-on: ${{ matrix.job.os }}
39+
env:
40+
IMAGE_NAME: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_search
41+
strategy:
42+
fail-fast: true
43+
matrix:
44+
job: ${{ fromJson(github.event.inputs.build_arm64 == 'true' && '[{"os":"ubuntu-22.04","name":"amd64","docker_platform":"linux/amd64"},{"os":"ubuntu-22.04-arm","name":"arm64v8","docker_platform":"linux/arm64"}]' || '[{"os":"ubuntu-22.04","name":"amd64","docker_platform":"linux/amd64"}]') }}
45+
46+
steps:
47+
- name: Check out the repository
48+
uses: actions/checkout@v4
49+
with:
50+
repository: AppFlowy-IO/AppFlowy-Cloud-Premium
51+
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
52+
ref: ${{ github.event.inputs.appflowy_cloud_branch }}
53+
fetch-depth: 1
54+
55+
- name: Set up QEMU
56+
uses: docker/setup-qemu-action@v3
57+
58+
- name: Set up Docker Buildx
59+
uses: docker/setup-buildx-action@v3
60+
61+
- name: Get git tag
62+
id: vars
63+
run: |
64+
T="${{ github.event.inputs.custom_tag }}"
65+
echo "GIT_TAG=$T" >> $GITHUB_ENV
66+
67+
- name: Extract metadata
68+
id: meta
69+
uses: docker/metadata-action@v4
70+
with:
71+
images: registry.hub.docker.com/${{ env.IMAGE_NAME }}
72+
73+
- name: Build and save ${{ matrix.job.name }}:${{ env.GIT_TAG }}
74+
uses: docker/build-push-action@v5
75+
with:
76+
context: .
77+
platforms: ${{ matrix.job.docker_platform }}
78+
file: ./services/appflowy-search/Dockerfile
79+
push: false
80+
load: true
81+
cache-from: type=gha,scope=appflowy_search-${{ matrix.job.name }}
82+
cache-to: type=gha,mode=max,scope=appflowy_search-${{ matrix.job.name }}
83+
tags: |
84+
${{ env.IMAGE_NAME }}:${{ env.LATEST_TAG }}-${{ matrix.job.name }}
85+
${{ env.IMAGE_NAME }}:${{ env.GIT_TAG }}-${{ matrix.job.name }}
86+
labels: ${{ steps.meta.outputs.labels }}
87+
provenance: false
88+
build-args: |
89+
PROFILE=release
90+
APP_VERSION=${{ env.GIT_TAG }}
91+
92+
- name: Save AppFlowy Search image locally
93+
run: |
94+
mkdir -p /tmp/docker-images
95+
docker save ${{ env.IMAGE_NAME }}:${{ env.GIT_TAG }}-${{ matrix.job.name }} | gzip > /tmp/docker-images/appflowy_search_${{ matrix.job.name }}.tar.gz
96+
docker save ${{ env.IMAGE_NAME }}:${{ env.LATEST_TAG }}-${{ matrix.job.name }} | gzip > /tmp/docker-images/appflowy_search_latest_${{ matrix.job.name }}.tar.gz
97+
98+
- name: Upload AppFlowy Search image as artifact
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: appflowy-search-image-${{ matrix.job.name }}
102+
path: /tmp/docker-images/appflowy_search_*.tar.gz
103+
retention-days: 1
104+
105+
- name: Logout from Docker Hub
106+
if: always()
107+
run: docker logout
108+
109+
appflowy_search_push:
110+
runs-on: ubuntu-22.04
111+
if: ${{ github.event.inputs.push_appflowy_search == 'true' }}
112+
needs: [appflowy_search_image]
113+
env:
114+
IMAGE_NAME: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_search
115+
strategy:
116+
fail-fast: true
117+
matrix:
118+
job: ${{ fromJson(github.event.inputs.build_arm64 == 'true' && '[{"name":"amd64"},{"name":"arm64v8"}]' || '[{"name":"amd64"}]') }}
119+
steps:
120+
- name: Get git tag
121+
id: vars
122+
run: |
123+
T="${{ github.event.inputs.custom_tag }}"
124+
echo "GIT_TAG=$T" >> $GITHUB_ENV
125+
126+
- name: Download AppFlowy Search image
127+
uses: actions/download-artifact@v4
128+
with:
129+
name: appflowy-search-image-${{ matrix.job.name }}
130+
path: /tmp/docker-images
131+
132+
- name: Log in to Docker Hub
133+
uses: docker/login-action@v3
134+
with:
135+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
136+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
137+
138+
- name: Load and Push AppFlowy Search
139+
run: |
140+
docker load < /tmp/docker-images/appflowy_search_${{ matrix.job.name }}.tar.gz
141+
docker load < /tmp/docker-images/appflowy_search_latest_${{ matrix.job.name }}.tar.gz || true
142+
if [[ "${{ github.event.inputs.tag_latest }}" == "true" ]]; then
143+
docker push ${{ env.IMAGE_NAME }}:${{ env.LATEST_TAG }}-${{ matrix.job.name }}
144+
fi
145+
docker push ${{ env.IMAGE_NAME }}:${{ env.GIT_TAG }}-${{ matrix.job.name }}
146+
147+
- name: Logout from Docker Hub
148+
if: always()
149+
run: docker logout
150+
151+
appflowy_search_manifest:
152+
runs-on: ubuntu-22.04
153+
if: ${{ github.event.inputs.push_appflowy_search == 'true' }}
154+
needs: [appflowy_search_push]
155+
steps:
156+
- name: Log in to Docker Hub
157+
uses: docker/login-action@v3
158+
with:
159+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
160+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
161+
162+
- name: Get git tag
163+
id: vars
164+
run: |
165+
T="${{ github.event.inputs.custom_tag }}"
166+
echo "GIT_TAG=$T" >> $GITHUB_ENV
167+
168+
- name: Create and push manifest for appflowy_search:version
169+
uses: Noelware/docker-manifest-action@0.4.3
170+
with:
171+
inputs: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_search:${{ env.GIT_TAG }}
172+
images: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_search:${{ env.GIT_TAG }}-amd64${{ github.event.inputs.build_arm64 == 'true' && format(',{0}/appflowy_search:{1}-arm64v8', secrets.DOCKER_HUB_USERNAME, env.GIT_TAG) || '' }}
173+
push: true
174+
175+
- name: Create and push manifest for appflowy_search:latest
176+
if: ${{ github.event.inputs.tag_latest == 'true' }}
177+
uses: Noelware/docker-manifest-action@0.4.3
178+
with:
179+
inputs: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_search:${{ env.LATEST_TAG }}
180+
images: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_search:${{ env.LATEST_TAG }}-amd64${{ github.event.inputs.build_arm64 == 'true' && format(',{0}/appflowy_search:{1}-arm64v8', secrets.DOCKER_HUB_USERNAME, env.LATEST_TAG) || '' }}
181+
push: true
182+
183+
- name: Logout from Docker Hub
184+
if: always()
185+
run: docker logout
186+
187+
cleanup_artifacts:
188+
runs-on: ubuntu-22.04
189+
if: always()
190+
needs: [appflowy_search_manifest]
191+
steps:
192+
- name: Delete AppFlowy Search artifacts
193+
uses: geekyeggo/delete-artifact@v5
194+
with:
195+
name: |
196+
appflowy-search-image-amd64
197+
appflowy-search-image-arm64v8
198+
failOnError: false
199+
200+
- name: Cleanup summary
201+
run: |
202+
echo "✅ Artifact cleanup completed"

.github/workflows/self_host_cloud_docker.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,6 @@ jobs:
928928
provenance: false
929929
build-args: |
930930
PROFILE=release
931-
FEATURES=${{ env.CI_APPFLOWY_CLOUD_FEATURES }}
932931
APP_VERSION=${{ env.GIT_TAG }}
933932
934933
- name: Save AppFlowy Search image locally

0 commit comments

Comments
 (0)