chore: update ci

This commit is contained in:
Nathan
2025-11-16 00:39:26 +08:00
parent fff815a4ea
commit e798916614

View File

@@ -1,7 +1,11 @@
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)' }}
run-name: Build AppFlowy Web ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name || github.ref_name }} ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag_latest == 'true' && 'latest' || github.event_name == 'push' && 'latest' || '' }}
on:
push:
tags:
- 'v*.*.*'
- '*.*.*'
workflow_dispatch:
inputs:
tag_name:
@@ -9,7 +13,7 @@ on:
required: true
type: string
appflowy_web_branch:
description: 'Branch to build from AppFlowy-Web-Premium repo'
description: 'Branch to build from AppFlowy-Web repo'
required: false
default: 'main'
type: string
@@ -23,11 +27,6 @@ on:
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
@@ -38,18 +37,15 @@ jobs:
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"}]') }}
job: ${{ fromJson((github.event_name == 'workflow_dispatch' && github.event.inputs.build_arm64 == 'true') || github.event_name == 'push' && '[{"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
IMAGE_NAME: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
repository: AppFlowy-IO/AppFlowy-Web-Premium
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
ref: ${{ github.event.inputs.appflowy_web_branch }}
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.appflowy_web_branch || github.ref }}
fetch-depth: 1
- name: Set up QEMU
@@ -67,16 +63,22 @@ jobs:
- name: Get git tag
id: vars
run: |
T="${{ github.event.inputs.tag_name }}"
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
T="${{ github.event.inputs.tag_name }}"
else
# Extract tag from ref (e.g., refs/tags/v1.2.3 -> v1.2.3)
T="${GITHUB_REF#refs/tags/}"
fi
echo "GIT_TAG=$T" >> $GITHUB_ENV
echo "Tag: $T"
- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
with:
images: registry.hub.docker.com/${{ env.IMAGE_NAME_PREMIUM }}
images: registry.hub.docker.com/${{ env.IMAGE_NAME }}
- name: Build and push to appflowy_web_premium
- name: Build and push to appflowy_web
uses: docker/build-push-action@v5
with:
context: .
@@ -86,10 +88,8 @@ jobs:
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) || '' }}
${{ env.IMAGE_NAME }}:${{ env.GIT_TAG }}-${{ matrix.job.arch }}
${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_latest == 'true') || github.event_name == 'push' && format('{0}:{1}-{2}', env.IMAGE_NAME, env.LATEST_TAG, matrix.job.arch) || '' }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false
build-args: |
@@ -112,38 +112,28 @@ jobs:
- name: Get git tag
id: vars
run: |
T="${{ github.event.inputs.tag_name }}"
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
T="${{ github.event.inputs.tag_name }}"
else
# Extract tag from ref (e.g., refs/tags/v1.2.3 -> v1.2.3)
T="${GITHUB_REF#refs/tags/}"
fi
echo "GIT_TAG=$T" >> $GITHUB_ENV
echo "Tag: $T"
- 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' }}
- name: Create and push manifest for appflowy_web:version
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) || '' }}
images: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web:${{ env.GIT_TAG }}-amd64${{ ((github.event_name == 'workflow_dispatch' && github.event.inputs.build_arm64 == 'true') || github.event_name == 'push') && 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' }}
- name: Create and push manifest for appflowy_web:latest
if: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_latest == 'true') || github.event_name == 'push' }}
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) || '' }}
images: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web:${{ env.LATEST_TAG }}-amd64${{ ((github.event_name == 'workflow_dispatch' && github.event.inputs.build_arm64 == 'true') || github.event_name == 'push') && format(',{0}/appflowy_web:{1}-arm64v8', secrets.DOCKER_HUB_USERNAME, env.LATEST_TAG) || '' }}
push: true
- name: Logout from Docker Hub