Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/release-image-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build and Push Dify API Docker Image (Separate AMD64 & ARM64 tags)

on:
workflow_dispatch:
inputs:
tag:
description: 'The tag to release'
required: true
push:
branches: [release-ci]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Workflow triggers on pull_request closed may cause unnecessary builds.

To avoid unnecessary builds when a PR is closed without merging, add a condition to check if 'github.event.pull_request.merged == true' in your workflow job.

Suggested implementation:

jobs:
  # Only run jobs if the PR was merged (not just closed)
  # Add this 'if' condition to each job definition below, for example:
  # build:
  #   if: github.event.pull_request.merged == true

You must add if: github.event.pull_request.merged == true to the top level of each job definition in this workflow file.
For example, if you have a job called build:, add the line directly under the job name:

build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
...

Repeat this for every job that should only run when the PR is merged.

pull_request:
types: [closed]
branches: [release-ci]

concurrency:
group: build-push-${{ github.run_id }}
cancel-in-progress: true

env:
REGISTRY_HOST: registry.cn-hangzhou.aliyuncs.com
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
IMAGE_BASE: ${{ env.REGISTRY_HOST }}/kindlingx/apo-dify-api

jobs:
build-api:
runs-on: ubuntu-latest
steps:
- name: Checkout
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v2

- name: Login to Aliyun Registry
if: github.event_name == 'workflow_dispatch'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY_HOST }}
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_TOKEN }}

- name: Set up QEMU
if: github.event_name == 'workflow_dispatch'
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
if: github.event_name == 'workflow_dispatch'
uses: docker/setup-buildx-action@v3

- name: Build & push AMD64 image
if: github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:api"
platforms: linux/amd64
push: true
tags: ${{ env.IMAGE_BASE }}:${{ inputs.tag }}
cache-from: type=gha,scope=dify-api-amd64
cache-to: type=gha,mode=max,scope=dify-api-amd64

- name: Build & push ARM64 image
if: github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:api"
platforms: linux/arm64
push: true
tags: ${{ env.IMAGE_BASE }}:${{ inputs.tag }}-arm64
cache-from: type=gha,scope=dify-api-arm64
cache-to: type=gha,mode=max,scope=dify-api-arm64
69 changes: 69 additions & 0 deletions .github/workflows/release-image-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build and Push Dify Web Docker Image (Separate AMD64 & ARM64 tags)

on:
workflow_dispatch:
inputs:
tag:
description: 'The tag to release'
required: true
push:
branches: [release-ci]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Workflow triggers on pull_request closed may cause unnecessary builds.

Consider refining the trigger or adding a condition so builds only run when PRs are merged, not just closed.

Suggested implementation:

jobs:
  build-and-push:
    if: github.event_name != 'pull_request' || github.event.pull_request.merged == true

  • If you already have a job defined (e.g., build-and-push), add the if: condition to that job instead of creating a new job block as above.
  • If there are multiple jobs, apply the if: condition to each job that should only run when the PR is merged.
  • Remove the extra indentation if you are not introducing a new job block.

pull_request:
types: [closed]
branches: [release-ci]

concurrency:
group: build-push-${{ github.run_id }}
cancel-in-progress: true

env:
REGISTRY_HOST: registry.cn-hangzhou.aliyuncs.com
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
IMAGE_BASE: ${{ env.REGISTRY_HOST }}/kindlingx/apo-dify-web

jobs:
build-web:
runs-on: ubuntu-latest
steps:
- name: Checkout
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v2

- name: Login to Aliyun Registry
if: github.event_name == 'workflow_dispatch'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY_HOST }}
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_TOKEN }}

- name: Set up QEMU
if: github.event_name == 'workflow_dispatch'
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
if: github.event_name == 'workflow_dispatch'
uses: docker/setup-buildx-action@v3

- name: Build & push AMD64 image
if: github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:web"
platforms: linux/amd64
push: true
tags: ${{ env.IMAGE_BASE }}:${{ inputs.tag }}
cache-from: type=gha,scope=dify-web-amd64
cache-to: type=gha,mode=max,scope=dify-web-amd64

- name: Build & push ARM64 image
if: github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:web"
platforms: linux/arm64
push: true
tags: ${{ env.IMAGE_BASE }}:${{ inputs.tag }}-arm64
cache-from: type=gha,scope=dify-web-arm64
cache-to: type=gha,mode=max,scope=dify-web-arm64