forked from langgenius/dify
-
Notifications
You must be signed in to change notification settings - Fork 3
add release-image.yml #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] | ||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
|
||
| 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 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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:
You must add
if: github.event.pull_request.merged == trueto 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.