-
Notifications
You must be signed in to change notification settings - Fork 2
151 lines (133 loc) · 6.41 KB
/
appflowy_web_docker.yml
File metadata and controls
151 lines (133 loc) · 6.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Build AppFlowy Web Docker Image
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)' }}
on:
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for the Docker image (e.g., v1.2.3 or 1.2.3)'
required: true
type: string
appflowy_web_branch:
description: 'Branch to build from AppFlowy-Web repo'
required: false
default: 'main'
type: string
build_arm64:
description: 'Also build ARM64 images (AMD64 always built)'
type: boolean
required: false
default: true
tag_latest:
description: 'Also tag and publish as latest'
type: boolean
required: false
default: true
push_public:
description: 'Also push to public appflowy_web repository'
type: boolean
required: false
default: false
env:
LATEST_TAG: latest
jobs:
appflowy_web_image:
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
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"}]') }}
env:
IMAGE_NAME_PREMIUM: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web_premium
IMAGE_NAME_PUBLIC: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
repository: AppFlowy-IO/AppFlowy-Web
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
ref: ${{ github.event.inputs.appflowy_web_branch }}
fetch-depth: 1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Get git tag
id: vars
run: |
T="${{ github.event.inputs.tag_name }}"
echo "GIT_TAG=$T" >> $GITHUB_ENV
- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
with:
images: registry.hub.docker.com/${{ env.IMAGE_NAME_PREMIUM }}
- name: Build and push to appflowy_web
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.job.platform }}
file: ./docker/Dockerfile.ssr
push: true
cache-from: type=gha,scope=appflowy_web-${{ matrix.job.arch }}
cache-to: type=gha,mode=max,scope=appflowy_web-${{ matrix.job.arch }}
tags: |
${{ env.IMAGE_NAME_PREMIUM }}:${{ env.GIT_TAG }}-${{ matrix.job.arch }}
${{ github.event.inputs.tag_latest == 'true' && format('{0}:{1}-{2}', env.IMAGE_NAME_PREMIUM, env.LATEST_TAG, matrix.job.arch) || '' }}
${{ github.event.inputs.push_public == 'true' && format('{0}:{1}-{2}', env.IMAGE_NAME_PUBLIC, env.GIT_TAG, matrix.job.arch) || '' }}
${{ 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) || '' }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false
build-args: |
VERSION=${{ env.GIT_TAG }}
- name: Logout from Docker Hub
if: always()
run: docker logout
appflowy_web_manifest:
runs-on: ubuntu-22.04
needs: [appflowy_web_image]
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Get git tag
id: vars
run: |
T="${{ github.event.inputs.tag_name }}"
echo "GIT_TAG=$T" >> $GITHUB_ENV
- name: Create and push manifest for appflowy_web_premium:version
uses: Noelware/docker-manifest-action@0.4.3
with:
inputs: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web_premium:${{ env.GIT_TAG }}
images: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web_premium:${{ env.GIT_TAG }}-amd64${{ github.event.inputs.build_arm64 == 'true' && format(',{0}/appflowy_web_premium:{1}-arm64v8', secrets.DOCKER_HUB_USERNAME, env.GIT_TAG) || '' }}
push: true
- name: Create and push manifest for appflowy_web_premium:latest
if: ${{ github.event.inputs.tag_latest == 'true' }}
uses: Noelware/docker-manifest-action@0.4.3
with:
inputs: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web_premium:${{ env.LATEST_TAG }}
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) || '' }}
push: true
- name: Create and push manifest for appflowy_web:version (public)
if: ${{ github.event.inputs.push_public == 'true' }}
uses: Noelware/docker-manifest-action@0.4.3
with:
inputs: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web:${{ env.GIT_TAG }}
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) || '' }}
push: true
- name: Create and push manifest for appflowy_web:latest (public)
if: ${{ github.event.inputs.push_public == 'true' && github.event.inputs.tag_latest == 'true' }}
uses: Noelware/docker-manifest-action@0.4.3
with:
inputs: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web:${{ env.LATEST_TAG }}
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) || '' }}
push: true
- name: Logout from Docker Hub
if: always()
run: docker logout