ci-10
This commit is contained in:
		
							parent
							
								
									ea770f4ae8
								
							
						
					
					
						commit
						9a959b4cae
					
				@ -13,8 +13,7 @@ on:
 | 
			
		||||
 | 
			
		||||
env:
 | 
			
		||||
  REGISTRY: ghcr.io  # 直接使用GHCR
 | 
			
		||||
  IMAGE_NAME: test   # 对应您要推送的镜像名称
 | 
			
		||||
  GHCR_USER: havoc412 # 您的GitHub用户名
 | 
			
		||||
  IMAGE_NAME: catface_backend_go   # 对应您要推送的镜像名称
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build-and-push:
 | 
			
		||||
@ -28,7 +27,7 @@ jobs:
 | 
			
		||||
        run: |
 | 
			
		||||
          echo "Registry: ${{ env.REGISTRY }}"
 | 
			
		||||
          echo "Image: ${{ env.GHCR_USER }}/${{ env.IMAGE_NAME }}"
 | 
			
		||||
          echo "GitHub Actor: ${{ gitea.actor }}"
 | 
			
		||||
          echo "Gitea Actor: ${{ gitea.actor }}"
 | 
			
		||||
 | 
			
		||||
      - name: 检出代码
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
@ -54,17 +53,17 @@ jobs:
 | 
			
		||||
          username: ${{ env.GHCR_USER }}
 | 
			
		||||
          password: ${{ secrets.GHCR_TOKEN }} # 在Gitea仓库设置中添加此secret
 | 
			
		||||
 | 
			
		||||
      # - name: 构建并推送 Docker 镜像
 | 
			
		||||
      #   uses: docker/build-push-action@v5
 | 
			
		||||
      #   with:
 | 
			
		||||
      #     context: .
 | 
			
		||||
      #     push: true
 | 
			
		||||
      #     tags: |
 | 
			
		||||
      #       ${{ env.REGISTRY }}/${{ env.GHCR_USER }}/${{ env.IMAGE_NAME }}:${{ steps.branch_name.outputs.tag }}
 | 
			
		||||
      #     labels: |
 | 
			
		||||
      #       org.opencontainers.image.source=${{ gitea.server_url }}/${{ gitea.repository }}
 | 
			
		||||
      #     build-args: |
 | 
			
		||||
      #       BUILDKIT_INLINE_CACHE=1
 | 
			
		||||
      - name: 构建并推送 Docker 镜像
 | 
			
		||||
        uses: docker/build-push-action@v5
 | 
			
		||||
        with:
 | 
			
		||||
          context: .
 | 
			
		||||
          push: true
 | 
			
		||||
          tags: |
 | 
			
		||||
            ${{ env.REGISTRY }}/${{ env.GHCR_USER }}/${{ env.IMAGE_NAME }}:${{ steps.branch_name.outputs.tag }}
 | 
			
		||||
          labels: |
 | 
			
		||||
            org.opencontainers.image.source=${{ gitea.server_url }}/${{ gitea.repository }}
 | 
			
		||||
          build-args: |
 | 
			
		||||
            BUILDKIT_INLINE_CACHE=1
 | 
			
		||||
 | 
			
		||||
      # - name: 通过SSH部署到服务器
 | 
			
		||||
      #   if: ${{ steps.branch_name.outputs.branch == 'main' }} # 仅main分支触发部署
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user