Skip to content

feat: hot swapping #329

feat: hot swapping

feat: hot swapping #329

name: Preview build image
on:
workflow_dispatch:
pull_request_target:
branches: ['*']
permissions:
contents: read
packages: write
attestations: write
id-token: write
pull-requests: write
jobs:
preview-image:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- 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.ALI_HUB_USERNAME }}
password: ${{ secrets.ALI_HUB_PASSWORD }}
- name: Build and push for amd64
id: build
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
tags: |
${{ secrets.ALI_IMAGE_NAME }}/fastgpt-plugin-pr:${{ github.event.pull_request.head.sha }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.description=https://github.com/${{ github.repository }} image
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: '@finleyge/github-tools'
uses: FinleyGe/[email protected]
id: print-image-label
if: success()
with:
token: ${{ secrets.GITHUB_TOKEN }}
tool: issue-comment
title: Preview Image Label
body: |
Preview Images for this PR are:
```
${{ secrets.ALI_IMAGE_NAME }}/fastgpt-plugin-pr:${{ github.event.pull_request.head.sha }}
```