99 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			99 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
# name: docker-monica-build development
 | 
						|
 | 
						|
# on:
 | 
						|
#   push:
 | 
						|
#     branches-ignore:
 | 
						|
#       - main # Läuft auf allen Branches außer `main`
 | 
						|
 | 
						|
# jobs:
 | 
						|
#   dockerfile_lint:
 | 
						|
#     runs-on: ubuntu-22.04
 | 
						|
#     steps:
 | 
						|
#       - uses: actions/checkout@v4
 | 
						|
#       - uses: hadolint/hadolint-action@v3.1.0
 | 
						|
#         with:
 | 
						|
#           dockerfile: Dockerfile
 | 
						|
 | 
						|
#   build:
 | 
						|
#     needs: dockerfile_lint
 | 
						|
#     runs-on: ubuntu-22.04
 | 
						|
#     steps:
 | 
						|
#       - uses: actions/checkout@v4
 | 
						|
#       - name: Clean Branch Name
 | 
						|
#         id: clean_branch_name
 | 
						|
#         run: |
 | 
						|
#           CLEANED_BRANCH_NAME=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | tr '/_' '-')
 | 
						|
#           echo "CLEAN_BRANCH_NAME=${CLEANED_BRANCH_NAME}" >> $GITHUB_ENV
 | 
						|
#       - name: Kaniko build
 | 
						|
#         uses: aevea/action-kaniko@v0.12.0
 | 
						|
#         with:
 | 
						|
#           image: rogersik/monica
 | 
						|
#           registry: gitea.sikorski.cloud
 | 
						|
#           tag: "${{ env.CLEAN_BRANCH_NAME }}"
 | 
						|
#           cache: true
 | 
						|
#           username: rogersik
 | 
						|
#           password: ${{ secrets.REGISTRY_PASSWORD }}
 | 
						|
 | 
						|
name: ci
 | 
						|
 | 
						|
on:
 | 
						|
  push:
 | 
						|
 | 
						|
jobs:
 | 
						|
  build:
 | 
						|
    name: Build Image
 | 
						|
    runs-on: ubuntu-latest
 | 
						|
    container:
 | 
						|
      image: docker:dind
 | 
						|
 | 
						|
    steps:
 | 
						|
 | 
						|
    - name: Set up Docker Context for Buildx
 | 
						|
      id: buildx-context
 | 
						|
      shell: sh
 | 
						|
      run: |
 | 
						|
        docker context use builders || docker context create builders
 | 
						|
        apk add nodejs
 | 
						|
 | 
						|
    - name: Set up Docker Buildx
 | 
						|
      uses: https://github.com/docker/setup-buildx-action@v3
 | 
						|
      with:
 | 
						|
        version: latest
 | 
						|
        endpoint: builders
 | 
						|
 | 
						|
    - name: Login to gitea.sikorski.cloud
 | 
						|
      uses: docker/login-action@v3
 | 
						|
      with:
 | 
						|
        registry: gitea.sikorski.cloud
 | 
						|
        username: rogersik
 | 
						|
        password: ${{ secrets.REGISTRY_PASSWORD }}
 | 
						|
 | 
						|
    - name: Docker Meta
 | 
						|
      id: meta
 | 
						|
      uses: https://github.com/docker/metadata-action@v5
 | 
						|
      with:
 | 
						|
        images: ${{ secrets.REGISTRY_URL }}
 | 
						|
        flavor: |
 | 
						|
          latest=false
 | 
						|
        tags: |
 | 
						|
          type=sha,prefix=,format=short
 | 
						|
          type=ref,event=tag
 | 
						|
 | 
						|
    - name: Create Branch Name as valid tag name
 | 
						|
      id: clean_branch_name
 | 
						|
      run: |
 | 
						|
        CLEANED_BRANCH_NAME=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | tr '/_' '-')
 | 
						|
        echo "CLEAN_BRANCH_NAME=${CLEANED_BRANCH_NAME}" >> $GITHUB_ENV
 | 
						|
 | 
						|
    - name: Build and Push Docker Image
 | 
						|
      uses: https://github.com/docker/build-push-action@v6
 | 
						|
      env:
 | 
						|
        ACTIONS_RUNTIME_TOKEN: ''
 | 
						|
      with:
 | 
						|
        pull: true
 | 
						|
        # push: ${{ github.event_name != 'pull_request' }}
 | 
						|
        push: true
 | 
						|
        labels: ${{ steps.meta.outputs.labels }}
 | 
						|
        provenance: false
 | 
						|
        tags: gitea.sikorski.cloud/rogersik/monica:${{ env.CLEAN_BRANCH_NAME }}
 |