File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3838 ghcr.io/${{ env.REPOSITORY_LOWER }}/backend
3939 ghcr.io/${{ env.REPOSITORY_LOWER }}/frontend
4040 tags : |
41- type=semver,pattern={{version}}
42- type=semver,pattern={{major}}.{{minor}}
4341 type=ref,event=branch
4442 type=sha,format=short
4543
4846 with :
4947 context : ./backend
5048 push : true
51- tags : ghcr.io/${{ env.REPOSITORY_LOWER }}/backend:${{ steps.meta.outputs.version }},ghcr.io/${{ env.REPOSITORY_LOWER }}/backend:latest
49+ tags : |
50+ ghcr.io/${{ env.REPOSITORY_LOWER }}/backend:${{ steps.meta.outputs.tags }}
51+ ghcr.io/${{ env.REPOSITORY_LOWER }}/backend:latest
5252 cache-from : type=gha
5353 cache-to : type=gha,mode=max
5454
5757 with :
5858 context : ./blog-web
5959 push : true
60- tags : ghcr.io/${{ env.REPOSITORY_LOWER }}/frontend:${{ steps.meta.outputs.version }},ghcr.io/${{ env.REPOSITORY_LOWER }}/frontend:latest
60+ tags : |
61+ ghcr.io/${{ env.REPOSITORY_LOWER }}/frontend:${{ steps.meta.outputs.tags }}
62+ ghcr.io/${{ env.REPOSITORY_LOWER }}/frontend:latest
6163 cache-from : type=gha
6264 cache-to : type=gha,mode=max
6365 build-args : |
6668
6769 - name : 更新 Docker Compose 文件
6870 run : |
69- VERSION=${{ steps.meta.outputs.version }}
71+ # 取第一个标签(通常是 branch 或 sha 短哈希)
72+ VERSION=$(echo "${{ steps.meta.outputs.tags }}" | cut -d',' -f1)
7073 sed -i "s|build:\s*context: ./backend|image: ghcr.io/${REPOSITORY_LOWER}/backend:${VERSION}|g" docker-compose.yml
7174 sed -i "s|build:\s*context: ./blog-web|image: ghcr.io/${REPOSITORY_LOWER}/frontend:${VERSION}|g" docker-compose.yml
7275 env :
You can’t perform that action at this time.
0 commit comments