mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2026-03-13 10:00:26 +08:00
145 lines
4.6 KiB
YAML
145 lines
4.6 KiB
YAML
name: Manually Build Public AppFlowy Web Docker Images
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
branch:
|
|
description: "Branch to build from"
|
|
required: true
|
|
default: "main"
|
|
version:
|
|
description: "Enter the release version tag (e.g. v0.9.30 or 0.9.30)"
|
|
required: true
|
|
archs:
|
|
description: "Target architectures (comma separated), e.g. linux/amd64,linux/arm64"
|
|
required: false
|
|
default: "linux/amd64"
|
|
|
|
env:
|
|
IMAGE_NAME: ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_web
|
|
|
|
jobs:
|
|
setup:
|
|
runs-on: ubuntu-24.04
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
image_tag: ${{ steps.set-version.outputs.image_tag }}
|
|
steps:
|
|
- name: Set up version
|
|
id: set-version
|
|
run: |
|
|
VERSION="${{ github.event.inputs.version }}"
|
|
# Remove 'v' prefix if present
|
|
IMAGE_TAG=${VERSION#v}
|
|
echo "image_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
|
|
echo "Image tag: ${IMAGE_TAG}"
|
|
|
|
- name: Set up architecture matrix
|
|
id: set-matrix
|
|
run: |
|
|
# Convert comma-separated archs to JSON array
|
|
archs="${{ github.event.inputs.archs }}"
|
|
# Create matrix with platform field
|
|
platforms=$(echo "$archs" | sed 's/,/","/g' | sed 's/^/["/' | sed 's/$/"]/')
|
|
echo "matrix={\"platform\":$platforms}" >> $GITHUB_OUTPUT
|
|
echo "Generated matrix: {\"platform\":$platforms}"
|
|
|
|
build:
|
|
runs-on: ubuntu-24.04
|
|
needs: setup
|
|
strategy:
|
|
matrix: ${{ fromJson(needs.setup.outputs.matrix) }}
|
|
steps:
|
|
- name: Prepare
|
|
run: |
|
|
PLATFORM=${{ matrix.platform }}
|
|
IMAGE_TAG=${{ needs.setup.outputs.image_tag }}
|
|
echo "PLATFORM_PAIR=${PLATFORM//\//-}" >> $GITHUB_ENV
|
|
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.inputs.branch }}
|
|
fetch-depth: 1
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-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: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
platforms: ${{ matrix.platform }}
|
|
tags: |
|
|
${{ env.IMAGE_NAME }}:test-${{ env.IMAGE_TAG }}-${{ env.PLATFORM_PAIR }}
|
|
${{ env.IMAGE_NAME }}:test-latest-${{ env.PLATFORM_PAIR }}
|
|
build-args: VERSION=${{ github.event.inputs.version }}
|
|
context: .
|
|
file: docker/Dockerfile
|
|
provenance: false
|
|
push: true
|
|
|
|
merge:
|
|
runs-on: ubuntu-24.04
|
|
needs:
|
|
- setup
|
|
- build
|
|
steps:
|
|
- name: Prepare
|
|
run: |
|
|
IMAGE_TAG=${{ needs.setup.outputs.image_tag }}
|
|
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Generate manifest image list
|
|
id: generate-manifest
|
|
run: |
|
|
# Get architectures and create image list
|
|
archs="${{ github.event.inputs.archs }}"
|
|
IMAGE_LIST=""
|
|
|
|
# Convert architectures to image tags
|
|
IFS=',' read -ra ARCH_ARRAY <<< "$archs"
|
|
for arch in "${ARCH_ARRAY[@]}"; do
|
|
platform_pair=${arch//\//-}
|
|
if [ -n "$IMAGE_LIST" ]; then
|
|
IMAGE_LIST="${IMAGE_LIST},"
|
|
fi
|
|
IMAGE_LIST="${IMAGE_LIST}${{ env.IMAGE_NAME }}:test-${{ env.IMAGE_TAG }}-${platform_pair}"
|
|
done
|
|
|
|
echo "image_list=${IMAGE_LIST}" >> $GITHUB_OUTPUT
|
|
echo "latest_list=${IMAGE_LIST//test-${{ env.IMAGE_TAG }}/test-latest}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create and push version manifest
|
|
uses: Noelware/docker-manifest-action@0.4.3
|
|
with:
|
|
inputs: ${{ env.IMAGE_NAME }}:test-${{ env.IMAGE_TAG }}
|
|
images: ${{ steps.generate-manifest.outputs.image_list }}
|
|
push: true
|
|
|
|
- name: Create and push latest manifest
|
|
uses: Noelware/docker-manifest-action@0.4.3
|
|
with:
|
|
inputs: ${{ env.IMAGE_NAME }}:test-latest
|
|
images: ${{ steps.generate-manifest.outputs.latest_list }}
|
|
push: true
|