mirror of
				https://github.com/ItsDrike/itsdrike.com.git
				synced 2025-11-03 19:56:36 +00:00 
			
		
		
		
	Add continuous delivery to CI
This commit is contained in:
		
							parent
							
								
									2d81a23ae8
								
							
						
					
					
						commit
						2433048db0
					
				
					 1 changed files with 19 additions and 1 deletions
				
			
		
							
								
								
									
										20
									
								
								.github/workflows/build-publish.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								.github/workflows/build-publish.yml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -4,13 +4,14 @@ on:
 | 
				
			||||||
  push:
 | 
					  push:
 | 
				
			||||||
    branches:
 | 
					    branches:
 | 
				
			||||||
      - main
 | 
					      - main
 | 
				
			||||||
 | 
					  workflow_dispatch:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
concurrency:
 | 
					concurrency:
 | 
				
			||||||
  group: ${{ github.workflow }}-${{ github.ref }}
 | 
					  group: ${{ github.workflow }}-${{ github.ref }}
 | 
				
			||||||
  cancel-in-progress: true
 | 
					  cancel-in-progress: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
jobs:
 | 
					jobs:
 | 
				
			||||||
  build-publish:
 | 
					  docker:
 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
| 
						 | 
					@ -78,3 +79,20 @@ jobs:
 | 
				
			||||||
            ghcr.io/itsdrike/web:${{ steps.sha_tag.outputs.tag }}
 | 
					            ghcr.io/itsdrike/web:${{ steps.sha_tag.outputs.tag }}
 | 
				
			||||||
          build-args: |
 | 
					          build-args: |
 | 
				
			||||||
            git_sha=${{ github.sha }}
 | 
					            git_sha=${{ github.sha }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  deploy-portainer:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    needs: [docker]
 | 
				
			||||||
 | 
					    env:
 | 
				
			||||||
 | 
					      WEBHOOK: ${{ secrets.PORTAINER_WEBHOOK }}
 | 
				
			||||||
 | 
					    if: (github.event_name == 'push' || github.event == 'workflow_dispatch') && github.ref == 'refs/heads/main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      - name: Trigger Portainer Webhook
 | 
				
			||||||
 | 
					        if: env.WEBHOOK != ''
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          response=$(curl -s -X POST -o /dev/null -w "%{http_code}" ${{ secrets.PORTAINER_WEBHOOK }})
 | 
				
			||||||
 | 
					          if [[ "$response" -lt 200 || "$response" -ge 300 ]]; then
 | 
				
			||||||
 | 
					            echo "Webhook trigger failed with response code $response"
 | 
				
			||||||
 | 
					            exit 1
 | 
				
			||||||
 | 
					          fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue