51 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
on:
 | 
						|
  pull_request:
 | 
						|
    branches:
 | 
						|
      - main
 | 
						|
  push:
 | 
						|
    branches:
 | 
						|
      - main
 | 
						|
 | 
						|
name: Build container
 | 
						|
 | 
						|
jobs:
 | 
						|
  build:
 | 
						|
    name: Build
 | 
						|
    runs-on: ubuntu-latest
 | 
						|
    steps:
 | 
						|
 | 
						|
    - uses: https://gitea.com/actions/checkout@v5
 | 
						|
 | 
						|
    - name: Fetch tags from main branch
 | 
						|
      id: version
 | 
						|
      run: |
 | 
						|
        git fetch origin main --tags
 | 
						|
        LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
 | 
						|
        # remove the 'v' prefix from the tag name
 | 
						|
        echo "BUILD_NAME=${LATEST_TAG//v}" >> $GITHUB_OUTPUT
 | 
						|
 | 
						|
    - name: Output the version that is being used
 | 
						|
      run: |
 | 
						|
        echo "Building for version ${{ steps.version.outputs.BUILD_NAME }}"
 | 
						|
 | 
						|
 | 
						|
    - name: Login to Docker Registry
 | 
						|
      uses: docker/login-action@v3
 | 
						|
      with:
 | 
						|
        registry: git.kluster.moll.re
 | 
						|
        username: ${{ gitea.repository_owner }}
 | 
						|
        password: ${{ secrets.PACKAGE_REGISTRY_ACCESS }}
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    - name: Set up Docker Buildx
 | 
						|
      uses: docker/setup-buildx-action@v3
 | 
						|
 | 
						|
    - name: Build and push
 | 
						|
      uses: docker/build-push-action@v6
 | 
						|
      with:
 | 
						|
        context: .
 | 
						|
        # use the current commit SHA as the tag
 | 
						|
        tags: git.kluster.moll.re/remoll/dns:${{ steps.version.outputs.BUILD_NAME }}-build.${{ gitea.run_number }}
 | 
						|
        push: true
 |