51 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| name: Build and deploy
 | |
| run-name: Build and deploy
 | |
| on:
 | |
|   push:
 | |
|     branches:
 | |
|       - main
 | |
| 
 | |
| jobs:
 | |
|   deploy:
 | |
|     runs-on: ubuntu-latest
 | |
|     steps:
 | |
|       - name: Checkout 
 | |
|         uses: actions/checkout@v4
 | |
|         with:
 | |
|           github-server-url: 'https://gitea.home.joemonk.co.uk'
 | |
| 
 | |
|       - name: Set up docker
 | |
|         run: 'curl -fsSL https://get.docker.com | sh'
 | |
| 
 | |
|       - name: Set up Docker Buildx
 | |
|         uses: docker/setup-buildx-action@v3
 | |
| 
 | |
|       - name: Login to gitea registry
 | |
|         uses: docker/login-action@v3
 | |
|         with:
 | |
|           registry: 'gitea.home.joemonk.co.uk/${{ github.repository }}'
 | |
|           username: ${{ secrets.REGISTRY_USERNAME }}
 | |
|           password: ${{ secrets.REGISTRY_PASSWORD }}
 | |
| 
 | |
|       - name: Login to flyio registry
 | |
|         uses: docker/login-action@v3
 | |
|         with:
 | |
|           registry: 'registry.fly.io'
 | |
|           username: x
 | |
|           password: ${{ secrets.FLY_API_TOKEN }}
 | |
| 
 | |
|       - name: Build and push
 | |
|         uses: docker/build-push-action@v6
 | |
|         with:
 | |
|           context: .
 | |
|           push: true
 | |
|           tags: |
 | |
|             gitea.home.joemonk.co.uk/${{ gitea.repository }}:latest
 | |
|             gitea.home.joemonk.co.uk/${{ gitea.repository }}:${{ gitea.sha }}
 | |
|             registry.fly.io/joemonk:${{ gitea.sha }}
 | |
| 
 | |
|       - uses: superfly/flyctl-actions/setup-flyctl@master
 | |
| 
 | |
|       - run: flyctl deploy --remote-only -i registry.fly.io/joemonk:${{ gitea.sha }}
 | |
|         env:
 | |
|           FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |