mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-07 01:02:55 +08:00
289da0f7b0
* sandbox-sync-agent * refactor: host pro as submodule * chore: checkpoint host pro restructure * refactor workspace test layout and startup init * chore: update next turbopack setup * chore: snapshot current work before actions fix * chore: update pro submodule * chore: point pro submodule url to upstream https * fix: Dockerfile * chore: update pro submodule * ci: support private pro submodule token and skip fork jobs * fix(ci): build sdk workspace deps before code-sandbox bundle * fix(app): exclude vitest configs from production typecheck * fix(app-image): build sdk packages before next build * fix(ci): align dockerfiles with workspace sdk build flow * chore(docker): upgrade node20 docker images to node24 * fix(ci): read admin coverage output path in pro test workflow * fix(app-image): include next-i18next config and locale assets * chore: update pro submodule * chore: do not specify branch for submodule * chore: remove most ts-nocheck sign * chore: update pro submodule * chore: remove sandbox-agent-sync package * chore: do not modify "pushData" file logic * fix: health check * chore: restore dev axios proxy state * fix: test-fastgpt report workflow * fix: use valid vitest coverage action inputs
104 lines
3.3 KiB
YAML
104 lines
3.3 KiB
YAML
name: Preview Admin Image - Build & Push
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [opened, synchronize, reopened]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: 'preview-admin-build-${{ github.head_ref }}'
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
pull-requests: write
|
|
issues: write
|
|
|
|
jobs:
|
|
build-and-push:
|
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository || secrets.PRO_SUBMODULE_TOKEN != '' }}
|
|
runs-on: ubuntu-24.04
|
|
|
|
steps:
|
|
- name: Checkout PR code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: refs/pull/${{ github.event.pull_request.number }}/head
|
|
fetch-depth: 0
|
|
|
|
- name: Update submodules
|
|
env:
|
|
PRO_SUBMODULE_TOKEN: ${{ secrets.PRO_SUBMODULE_TOKEN }}
|
|
run: |
|
|
if [ -f .gitmodules ]; then
|
|
if [ -n "${PRO_SUBMODULE_TOKEN}" ]; then
|
|
git config --global url."https://x-access-token:${PRO_SUBMODULE_TOKEN}@github.com/".insteadOf "https://github.com/"
|
|
fi
|
|
git submodule update --init --recursive
|
|
fi
|
|
|
|
- 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: Build and push Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: pro/admin/Dockerfile
|
|
platforms: linux/amd64
|
|
push: true
|
|
tags: ${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-pro-pr:${{ github.event.pull_request.head.sha }}
|
|
labels: |
|
|
org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/FastGPT
|
|
org.opencontainers.image.description=fastgpt-pro admin image
|
|
|
|
- name: Add PR comment on success
|
|
if: success()
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const prNumber = ${{ github.event.pull_request.number }};
|
|
const marker = '<!-- fastgpt-admin-preview -->';
|
|
|
|
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}
|
|
✅ **Admin Preview Image Ready!**
|
|
|
|
\`\`\`
|
|
${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-pro-pr:${{ github.event.pull_request.head.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
|
|
});
|
|
}
|