41 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
name: Release of a new version
 | 
						|
 | 
						|
on:
 | 
						|
  release:
 | 
						|
    types: [published]
 | 
						|
  workflow_dispatch:
 | 
						|
    inputs:
 | 
						|
      version:
 | 
						|
        description: 'Version to release'
 | 
						|
        required: true
 | 
						|
        default: 'latest'
 | 
						|
        type: string
 | 
						|
 | 
						|
jobs:
 | 
						|
  build:
 | 
						|
    runs-on: [dev, amd64]
 | 
						|
    env:
 | 
						|
      IMAGE: harbor.rosti.cz/rosti-public/database-backup
 | 
						|
    steps:
 | 
						|
      - uses: actions/checkout@v4
 | 
						|
 | 
						|
      # Figure out the tag
 | 
						|
      - name: Get git tag
 | 
						|
        id: get_tag
 | 
						|
        if: github.event_name == 'release'
 | 
						|
        run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
 | 
						|
      - name: Set version from input
 | 
						|
        if: github.event_name == 'workflow_dispatch'
 | 
						|
        run: echo "TAG_NAME=${{ github.event.inputs.version }}" >> $GITHUB_ENV
 | 
						|
 | 
						|
      - name: docker login
 | 
						|
        run: |
 | 
						|
          docker login harbor.rosti.cz -u "${{ secrets.REGISTRY_PROD_USERNAME }}" -p "${{ secrets.REGISTRY_PROD_PASSWORD }}"          
 | 
						|
      - name: Build
 | 
						|
        run: task build IMAGE=$IMAGE TAG=${{ env.TAG_NAME }}
 | 
						|
      - name: Tag latest
 | 
						|
        run: task tag-latest IMAGE=$IMAGE TAG=${{ env.TAG_NAME }}
 | 
						|
      - name: Push
 | 
						|
        run: task push IMAGE=$IMAGE TAG=${{ env.TAG_NAME }}
 | 
						|
      - name: Push latest
 | 
						|
        run: task push IMAGE=$IMAGE TAG=latest
 |