mirror of
				https://github.com/allenai/olmocr.git
				synced 2025-10-31 10:04:26 +00:00 
			
		
		
		
	fixing tag
This commit is contained in:
		
							parent
							
								
									beb8816677
								
							
						
					
					
						commit
						21e5ab5dd0
					
				
							
								
								
									
										65
									
								
								.github/workflows/docker-build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										65
									
								
								.github/workflows/docker-build.yml
									
									
									
									
										vendored
									
									
								
							| @ -1,17 +1,11 @@ | |||||||
| name: Build and Push Docker Image | name: Build and Push Docker Image | ||||||
| 
 |  | ||||||
| on: | on: | ||||||
|   # ① Run when a release is published … |  | ||||||
|   release: |   release: | ||||||
|     types: [published] |     types: [published] | ||||||
| 
 |  | ||||||
|   # ② … or when a SemVer-style tag is pushed (with or without “v” prefix) |  | ||||||
|   push: |   push: | ||||||
|     tags: |     tags: | ||||||
|       - 'v*'      # v1.2.3 |       - 'v*' | ||||||
|       - '*.*.*'   # 1.2.3 |       - '*.*.*' | ||||||
| 
 |  | ||||||
|   # ③ Manual trigger (optional) |  | ||||||
|   workflow_dispatch: |   workflow_dispatch: | ||||||
| 
 | 
 | ||||||
| env: | env: | ||||||
| @ -24,11 +18,23 @@ jobs: | |||||||
|     permissions: |     permissions: | ||||||
|       contents: read |       contents: read | ||||||
|       packages: write |       packages: write | ||||||
| 
 |  | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - name: Checkout repository | ||||||
|  |         uses: actions/checkout@v4 | ||||||
| 
 | 
 | ||||||
|       - uses: docker/setup-buildx-action@v3 |       - name: Free up disk space | ||||||
|  |         run: | | ||||||
|  |           sudo rm -rf /usr/share/dotnet \ | ||||||
|  |             /usr/local/lib/android \ | ||||||
|  |             /opt/ghc \ | ||||||
|  |             /opt/hostedtoolcache/CodeQL | ||||||
|  |           sudo docker system prune -af | ||||||
|  |           sudo apt-get -y autoremove | ||||||
|  |           sudo apt-get -y autoclean | ||||||
|  |           df -h | ||||||
|  | 
 | ||||||
|  |       - name: Set up Docker Buildx | ||||||
|  |         uses: docker/setup-buildx-action@v3 | ||||||
| 
 | 
 | ||||||
|       - name: Log in to Docker Hub |       - name: Log in to Docker Hub | ||||||
|         uses: docker/login-action@v3 |         uses: docker/login-action@v3 | ||||||
| @ -37,34 +43,27 @@ jobs: | |||||||
|           username: ${{ secrets.DOCKER_USERNAME }} |           username: ${{ secrets.DOCKER_USERNAME }} | ||||||
|           password: ${{ secrets.DOCKER_PASSWORD }} |           password: ${{ secrets.DOCKER_PASSWORD }} | ||||||
| 
 | 
 | ||||||
|       # --------------------------------------------- |  | ||||||
|       # Tag & label generation – never create :latest |  | ||||||
|       # --------------------------------------------- |  | ||||||
|       - name: Extract metadata |       - name: Extract metadata | ||||||
|         id: meta |         id: meta | ||||||
|         uses: docker/metadata-action@v5 |         uses: docker/metadata-action@v5 | ||||||
|         with: |         with: | ||||||
|           images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |           images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||||||
|           flavor: | |  | ||||||
|             latest=false                         # ban implicit :latest |  | ||||||
|           tags: | |           tags: | | ||||||
|             # Tags coming from a pushed Git tag |  | ||||||
|             type=ref,event=tag |             type=ref,event=tag | ||||||
|  |             type=semver,pattern={{version}} | ||||||
|  |             type=semver,pattern={{major}}.{{minor}} | ||||||
|  |             type=semver,pattern={{major}} | ||||||
|  |             type=raw,value=latest,enable={{is_default_branch}} | ||||||
|  |             type=raw,value={{date 'YYYYMMDD-HHmmss'}}-{{sha}},enable=${{ github.event_name == 'workflow_dispatch' }} | ||||||
|  |           flavor: | | ||||||
|  |             latest=false | ||||||
| 
 | 
 | ||||||
|             # Release event → use the release tag name |       - name: Debug metadata | ||||||
|             type=raw,value=${{ github.event.release.tag_name }},enable=${{ github.event_name == 'release' }} |  | ||||||
|             type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }} |  | ||||||
|             type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'release' }} |  | ||||||
|             type=semver,pattern={{major}},enable=${{ github.event_name == 'release' }} |  | ||||||
| 
 |  | ||||||
|       # Fail fast if no tags were produced |  | ||||||
|       - name: Abort when tag list is empty |  | ||||||
|         if: ${{ steps.meta.outputs.tags == '' }} |  | ||||||
|         run: | |         run: | | ||||||
|           echo "::error ::No Docker tags were generated for this event. Did you trigger the workflow without a Git tag or Release tag?" |           echo "Tags: ${{ steps.meta.outputs.tags }}" | ||||||
|           exit 1 |           echo "Labels: ${{ steps.meta.outputs.labels }}" | ||||||
| 
 | 
 | ||||||
|       - name: Build and push image |       - name: Build and push Docker image | ||||||
|         uses: docker/build-push-action@v5 |         uses: docker/build-push-action@v5 | ||||||
|         with: |         with: | ||||||
|           context: . |           context: . | ||||||
| @ -74,4 +73,10 @@ jobs: | |||||||
|           labels: ${{ steps.meta.outputs.labels }} |           labels: ${{ steps.meta.outputs.labels }} | ||||||
|           platforms: linux/amd64 |           platforms: linux/amd64 | ||||||
|           outputs: type=registry |           outputs: type=registry | ||||||
|           no-cache: true |           no-cache: true | ||||||
|  | 
 | ||||||
|  |       - name: Clean up after build | ||||||
|  |         if: always() | ||||||
|  |         run: | | ||||||
|  |           docker system prune -af --volumes | ||||||
|  |           df -h | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 aman-17
						aman-17