Files
FastGPT/.github/workflows/preview-fastgpt-push.yml
T
Archer 3f4400a500 V4.14.10 dev (#6674)
* feat: model config with brand-new price calculate machanism (#6616)

* fix: image read and json error (Agent) (#6502)

* fix:
1.image read
2.JSON parsing error

* dataset cite and pause

* perf: plancall second parse

* add test

---------

Co-authored-by: archer <545436317@qq.com>

* master message

* remove invalid code

* wip: model config

* feat: model config with brand-new price calculate machanism

* merge main branch

* ajust calculate way

* ajust priceTiers resolve procession

* perf: price config code

* fix: default price

* fix: test

* fix: comment

* fix test

---------

Co-authored-by: YeYuheng <57035043+YYH211@users.noreply.github.com>
Co-authored-by: archer <545436317@qq.com>

* wip: fix modal UI (#6634)

* wip: fix modal UI

* fix: maxInputToken set

* chore: add price unit for non llm models

* chore: replace question mark icon with beta tag (#6672)

* feat:rerank too long; fix:rerank ui(agent),embedding returns 0 (#6663)

* feat:rerank too long; fix:rerank ui(agent),embedding returns 0

* rerank

* fix:rerank function

* perf: rerank code

* fix rerank

* perf: model price ui

---------

Co-authored-by: archer <545436317@qq.com>

* remove llmtype field

* revert model init

* fix: filed

* fix: model select filter

* perf: multiple selector render

* remove invalid checker

* remove invalid i18n

* perf: model selector tip

* perf: model selector tip

* fix cr

* limit pnpm version

* fix: i18n

* fix action

* set default mintoken

* update i18n

* perf: usage push

* fix:rerank model ui (#6677)

* fix: tier match error

* fix: testr

---------

Co-authored-by: Ryo <whoeverimf5@gmail.com>
Co-authored-by: YeYuheng <57035043+YYH211@users.noreply.github.com>
2026-03-30 10:05:42 +08:00

119 lines
3.8 KiB
YAML

name: Preview FastGPT Image — Push
on:
workflow_run:
workflows: ['Preview FastGPT Image — Build']
types: [completed]
# Only one push at a time
concurrency:
group: 'preview-fastgpt-push'
cancel-in-progress: false
permissions:
contents: read
packages: write
attestations: write
id-token: write
pull-requests: write
issues: write
actions: read
jobs:
push:
runs-on: ubuntu-24.04
# Only push when the build succeeded
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
image: [fastgpt, code-sandbox, mcp_server]
fail-fast: false
steps:
- name: Set image config
id: config
run: |
if [[ "${{ matrix.image }}" == "fastgpt" ]]; then
echo "IMAGE_NAME=fastgpt" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.image }}" == "code-sandbox" ]]; then
echo "IMAGE_NAME=fastgpt-code-sandbox" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.image }}" == "mcp_server" ]]; then
echo "IMAGE_NAME=fastgpt-mcp-server" >> $GITHUB_OUTPUT
fi
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: preview-${{ matrix.image }}-image
path: /tmp
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Read PR metadata
id: pr
run: |
echo "number=$(cat /tmp/pr-number.txt)" >> "$GITHUB_OUTPUT"
echo "sha=$(cat /tmp/pr-sha.txt)" >> "$GITHUB_OUTPUT"
- name: Load Docker image
run: docker load --input /tmp/${{ steps.config.outputs.IMAGE_NAME }}-image.tar
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Aliyun Container Registry
uses: docker/login-action@v3
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Tag and push Docker image
run: |
SHA="${{ steps.pr.outputs.sha }}"
docker tag ${{ steps.config.outputs.IMAGE_NAME }}-pr:${SHA} \
${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-pr:${{ matrix.image }}_${SHA}
docker push ${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-pr:${{ matrix.image }}_${SHA}
- name: Add PR comment on success
if: success() && steps.pr.outputs.number != ''
uses: actions/github-script@v7
with:
script: |
const prNumber = parseInt('${{ steps.pr.outputs.number }}');
const marker = '<!-- fastgpt-preview-${{ matrix.image }} -->';
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
const existingComment = comments.find(comment =>
comment.body.includes(marker)
);
const commentBody = `${marker}
✅ **Build Successful** - Preview ${{ matrix.image }} Image for this PR:
\`\`\`
${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-pr:${{ matrix.image }}_${{ steps.pr.outputs.sha }}
\`\`\`
`;
if (existingComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body: commentBody
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: commentBody
});
}