Skip to content

Commit 054acb1

Browse files
committed
chore: update web ci
1 parent 1a6c560 commit 054acb1

1 file changed

Lines changed: 33 additions & 9 deletions

File tree

.github/workflows/appflowy_web_docker.yml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: Build AppFlowy Web Premium Docker Image
2-
run-name: Build AppFlowy Web Premium ${{ github.event.inputs.tag_name }} from ${{ github.event.inputs.appflowy_web_branch }} ${{ github.event.inputs.tag_latest == 'true' && 'latest' || '' }}
1+
name: Build AppFlowy Web Docker Image
2+
run-name: Build AppFlowy Web ${{ github.event.inputs.tag_name }} from ${{ github.event.inputs.appflowy_web_branch }} ${{ github.event.inputs.tag_latest == 'true' && 'latest' || '' }} ${{ github.event.inputs.push_public == 'true' && '(public + premium)' || '(premium only)' }}
33

44
on:
55
workflow_dispatch:
@@ -23,6 +23,11 @@ on:
2323
type: boolean
2424
required: false
2525
default: true
26+
push_public:
27+
description: 'Also push to public appflowy_web repository'
28+
type: boolean
29+
required: false
30+
default: false
2631

2732
env:
2833
LATEST_TAG: latest
@@ -35,7 +40,8 @@ jobs:
3540
matrix:
3641
job: ${{ fromJson(github.event.inputs.build_arm64 == 'true' && '[{"os":"ubuntu-22.04","platform":"linux/amd64","arch":"amd64"},{"os":"ubuntu-22.04-arm","platform":"linux/arm64","arch":"arm64v8"}]' || '[{"os":"ubuntu-22.04","platform":"linux/amd64","arch":"amd64"}]') }}
3742
env:
38-
IMAGE_NAME: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web_premium
43+
IMAGE_NAME_PREMIUM: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web_premium
44+
IMAGE_NAME_PUBLIC: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web
3945

4046
steps:
4147
- name: Check out the repository
@@ -68,20 +74,22 @@ jobs:
6874
id: meta
6975
uses: docker/metadata-action@v4
7076
with:
71-
images: registry.hub.docker.com/${{ env.IMAGE_NAME }}
77+
images: registry.hub.docker.com/${{ env.IMAGE_NAME_PREMIUM }}
7278

73-
- name: Build and push ${{ env.IMAGE_NAME }}:${{ env.GIT_TAG }}-${{ matrix.job.arch }}
79+
- name: Build and push to appflowy_web_premium
7480
uses: docker/build-push-action@v5
7581
with:
7682
context: .
7783
platforms: ${{ matrix.job.platform }}
7884
file: ./docker/Dockerfile.ssr
7985
push: true
80-
cache-from: type=gha,scope=appflowy_web_premium-${{ matrix.job.arch }}
81-
cache-to: type=gha,mode=max,scope=appflowy_web_premium-${{ matrix.job.arch }}
86+
cache-from: type=gha,scope=appflowy_web-${{ matrix.job.arch }}
87+
cache-to: type=gha,mode=max,scope=appflowy_web-${{ matrix.job.arch }}
8288
tags: |
83-
${{ env.IMAGE_NAME }}:${{ env.GIT_TAG }}-${{ matrix.job.arch }}
84-
${{ github.event.inputs.tag_latest == 'true' && format('{0}:{1}-{2}', env.IMAGE_NAME, env.LATEST_TAG, matrix.job.arch) || '' }}
89+
${{ env.IMAGE_NAME_PREMIUM }}:${{ env.GIT_TAG }}-${{ matrix.job.arch }}
90+
${{ github.event.inputs.tag_latest == 'true' && format('{0}:{1}-{2}', env.IMAGE_NAME_PREMIUM, env.LATEST_TAG, matrix.job.arch) || '' }}
91+
${{ github.event.inputs.push_public == 'true' && format('{0}:{1}-{2}', env.IMAGE_NAME_PUBLIC, env.GIT_TAG, matrix.job.arch) || '' }}
92+
${{ github.event.inputs.push_public == 'true' && github.event.inputs.tag_latest == 'true' && format('{0}:{1}-{2}', env.IMAGE_NAME_PUBLIC, env.LATEST_TAG, matrix.job.arch) || '' }}
8593
labels: ${{ steps.meta.outputs.labels }}
8694
provenance: false
8795
build-args: |
@@ -122,6 +130,22 @@ jobs:
122130
images: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web_premium:${{ env.LATEST_TAG }}-amd64${{ github.event.inputs.build_arm64 == 'true' && format(',{0}/appflowy_web_premium:{1}-arm64v8', secrets.DOCKER_HUB_USERNAME, env.LATEST_TAG) || '' }}
123131
push: true
124132

133+
- name: Create and push manifest for appflowy_web:version (public)
134+
if: ${{ github.event.inputs.push_public == 'true' }}
135+
uses: Noelware/docker-manifest-action@0.4.3
136+
with:
137+
inputs: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web:${{ env.GIT_TAG }}
138+
images: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web:${{ env.GIT_TAG }}-amd64${{ github.event.inputs.build_arm64 == 'true' && format(',{0}/appflowy_web:{1}-arm64v8', secrets.DOCKER_HUB_USERNAME, env.GIT_TAG) || '' }}
139+
push: true
140+
141+
- name: Create and push manifest for appflowy_web:latest (public)
142+
if: ${{ github.event.inputs.push_public == 'true' && github.event.inputs.tag_latest == 'true' }}
143+
uses: Noelware/docker-manifest-action@0.4.3
144+
with:
145+
inputs: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web:${{ env.LATEST_TAG }}
146+
images: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web:${{ env.LATEST_TAG }}-amd64${{ github.event.inputs.build_arm64 == 'true' && format(',{0}/appflowy_web:{1}-arm64v8', secrets.DOCKER_HUB_USERNAME, env.LATEST_TAG) || '' }}
147+
push: true
148+
125149
- name: Logout from Docker Hub
126150
if: always()
127151
run: docker logout

0 commit comments

Comments
 (0)