mirror of
				https://github.com/Frooodle/Stirling-PDF.git
				synced 2025-11-01 01:21:18 +01:00 
			
		
		
		
	Merge pull request #101 from pl4nty/patch-1
Support GitHub Container Registry
This commit is contained in:
		
						commit
						243e4889b9
					
				
							
								
								
									
										75
									
								
								.github/workflows/push-docker.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										75
									
								
								.github/workflows/push-docker.yml
									
									
									
									
										vendored
									
									
								
							@ -1,10 +1,10 @@
 | 
			
		||||
name: Push Docker Image with VersionNumber
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
  push:
 | 
			
		||||
    branches: 
 | 
			
		||||
      - master
 | 
			
		||||
      - testGit
 | 
			
		||||
      - main
 | 
			
		||||
jobs:
 | 
			
		||||
  push:
 | 
			
		||||
@ -12,16 +12,16 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
 | 
			
		||||
    - uses: actions/checkout@v3
 | 
			
		||||
    - uses: actions/checkout@v3.5.2
 | 
			
		||||
    
 | 
			
		||||
    - name: Set up JDK 17
 | 
			
		||||
      uses: actions/setup-java@v3
 | 
			
		||||
      uses: actions/setup-java@v3.11.0
 | 
			
		||||
      with:
 | 
			
		||||
        java-version: '17'
 | 
			
		||||
        distribution: 'temurin'
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    - uses: gradle/gradle-build-action@v2.3.3
 | 
			
		||||
    - uses: gradle/gradle-build-action@v2.4.2
 | 
			
		||||
      with:
 | 
			
		||||
        gradle-version: 7.6
 | 
			
		||||
        arguments: clean build
 | 
			
		||||
@ -37,43 +37,38 @@ jobs:
 | 
			
		||||
      uses: docker/login-action@v2.1.0
 | 
			
		||||
      with:
 | 
			
		||||
        username: ${{ secrets.DOCKER_HUB_USERNAME }}
 | 
			
		||||
        password: ${{ secrets.DOCKER_HUB_API }} 
 | 
			
		||||
   
 | 
			
		||||
  #  - name: Check if tag exists
 | 
			
		||||
  #    id: checkIdExists
 | 
			
		||||
  #    continue-on-error: true
 | 
			
		||||
  #    run: |
 | 
			
		||||
  #      response=$(curl -s https://hub.docker.com/v2/repositories/frooodle/s-pdf/tags/?name=${{ steps.versionNumber.outputs.versionNumber }})
 | 
			
		||||
  #      result=$(echo $response | jq ".results")
 | 
			
		||||
  #      if [ "$result" == "[]" ]; then
 | 
			
		||||
  #        echo "Tag ${{ steps.versionNumber.outputs.versionNumber }} doesnt exist. Continuing with build and push."
 | 
			
		||||
  #      else
 | 
			
		||||
  #        echo "Tag ${{ steps.versionNumber.outputs.versionNumber }} already exists. Skipping build and push."
 | 
			
		||||
  #        exit 1;
 | 
			
		||||
  #      fi
 | 
			
		||||
 | 
			
		||||
   
 | 
			
		||||
   
 | 
			
		||||
    - name: Setup buildx
 | 
			
		||||
      run: |
 | 
			
		||||
        docker buildx create --name mybuilder
 | 
			
		||||
        docker buildx use mybuilder
 | 
			
		||||
 | 
			
		||||
    - name: Build and push versioned amd64 and v8 
 | 
			
		||||
      if: github.ref == 'refs/heads/main'
 | 
			
		||||
      run: | 
 | 
			
		||||
        docker buildx build --platform="linux/amd64,linux/arm64/v8" --push --tag "frooodle/s-pdf:${{ steps.versionNumber.outputs.versionNumber }}-alpha" .
 | 
			
		||||
 | 
			
		||||
        password: ${{ secrets.DOCKER_HUB_API }}
 | 
			
		||||
        
 | 
			
		||||
    - name: Build and push versioned amd64 and v8 
 | 
			
		||||
      if: github.ref == 'refs/heads/master'
 | 
			
		||||
      run: | 
 | 
			
		||||
        docker buildx build --platform="linux/amd64,linux/arm64/v8" --push --tag "frooodle/s-pdf:${{ steps.versionNumber.outputs.versionNumber }}" .
 | 
			
		||||
    - name: Login to GitHub Container Registry
 | 
			
		||||
      uses: docker/login-action@v2.1.0
 | 
			
		||||
      with:
 | 
			
		||||
        registry: ghcr.io
 | 
			
		||||
        username: ${{ github.actor }}
 | 
			
		||||
        password: ${{ github.token }}
 | 
			
		||||
 | 
			
		||||
    - name: Generate tags
 | 
			
		||||
      id: meta
 | 
			
		||||
      uses: docker/metadata-action@v4.4.0
 | 
			
		||||
      with:
 | 
			
		||||
        images: |
 | 
			
		||||
          ${{ secrets.DOCKER_HUB_USERNAME }}/s-pdf
 | 
			
		||||
          ghcr.io/${{ github.repository_owner }}/s-pdf
 | 
			
		||||
        tags: |
 | 
			
		||||
          ${{ steps.versionNumber.outputs.versionNumber }}${{ github.ref == 'refs/heads/main' && '-alpha' || '' }}
 | 
			
		||||
   
 | 
			
		||||
    - name: Build and push latest amd64 and v8
 | 
			
		||||
      if: github.ref == 'refs/heads/master'
 | 
			
		||||
      run: | 
 | 
			
		||||
        docker buildx build --platform="linux/amd64,linux/arm64/v8" --push --tag "frooodle/s-pdf:latest" .
 | 
			
		||||
        
 | 
			
		||||
    - name: Set up QEMU
 | 
			
		||||
      uses: docker/setup-qemu-action@v2.1.0
 | 
			
		||||
      
 | 
			
		||||
    - name: Set up Docker Buildx
 | 
			
		||||
      uses: docker/setup-buildx-action@v2.5.0
 | 
			
		||||
        
 | 
			
		||||
    - name: Build and push
 | 
			
		||||
      uses: docker/build-push-action@v4.0.0
 | 
			
		||||
      with:
 | 
			
		||||
        context: .
 | 
			
		||||
        push: true
 | 
			
		||||
        cache-from: type=gha
 | 
			
		||||
        cache-to: type=gha,mode=max
 | 
			
		||||
        tags: ${{ steps.meta.outputs.tags }}
 | 
			
		||||
        labels: ${{ steps.meta.outputs.labels }}
 | 
			
		||||
        platforms: linux/amd64,linux/arm64/v8
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user