57 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			YAML
		
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			YAML
		
	
	
	
| name: Publish image
 | |
| 
 | |
| on:
 | |
|   release:
 | |
|     types: [released]
 | |
| 
 | |
| jobs:
 | |
|   build:
 | |
|     env:
 | |
|       IMAGE_NAME: gcr.io/kaniko-project/executor
 | |
| 
 | |
|     runs-on: ubuntu-latest
 | |
|     steps:
 | |
|       - name: Get latest release tag      
 | |
|         uses: oprypin/find-latest-tag@v1
 | |
|         with:
 | |
|           repository: GoogleContainerTools/kaniko  # The repository to scan.
 | |
|           releases-only: true  # We know that all relevant tags have a GitHub release for them.
 | |
|         id: kaniko  
 | |
| 
 | |
|       - name: Clone source code
 | |
|         uses: actions/checkout@v2
 | |
|         with:
 | |
|           ref: ${{ steps.kaniko.outputs.tag }}
 | |
|       
 | |
|       - name: Set up QEMU
 | |
|         uses: docker/setup-qemu-action@v1
 | |
|         with:
 | |
|           platforms: all
 | |
|   
 | |
|       - name: Set up Docker Buildx
 | |
|         id: buildx
 | |
|         uses: docker/setup-buildx-action@v1
 | |
|         with:
 | |
|           version: latest
 | |
| 
 | |
|       - name: Available platforms
 | |
|         run: echo ${{ steps.buildx.outputs.platforms }}
 | |
| 
 | |
|       - name: Setup gcloud CLI 
 | |
|         uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
 | |
|         with:
 | |
|           service_account_key: ${{ secrets.GCR_DEVOPS_SERVICE_ACCOUNT_KEY }}
 | |
|           project_id: kaniko-project
 | |
|           export_default_credentials: true
 | |
|         
 | |
|       - name: Build and push image
 | |
|         run: |
 | |
|           gcloud auth configure-docker -q
 | |
|           IMAGE_VERSION="$(git describe --tags --abbrev=0)"
 | |
|           SHORT_SHA1=$(git rev-parse --short HEAD)
 | |
|           PLATFORMS="linux/amd64,linux/ppc64le,linux/arm64"
 | |
|           echo "Building and pushing version ${IMAGE_VERSION} of image ${IMAGE_NAME}"
 | |
|           docker buildx build --platform "${PLATFORMS}" -t "${IMAGE_NAME}:${IMAGE_VERSION}" -t "${IMAGE_NAME}:latest" -f ./deploy/Dockerfile \
 | |
|             --push .          
 | |
|     
 |