projectsyn/commodore

View on GitHub
.github/workflows/push-kapitan.yml

Summary

Maintainability
Test Coverage
name: Build & Push Kapitan Image
on:
  workflow_dispatch: {}
  push:
    branches:
      - master
    paths:
      - tools/Dockerfile.kapitan

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      IMAGE: docker.io/projectsyn/kapitan
    steps:
    - uses: actions/checkout@v4
    - name: Set image version
      run: |
        echo "VERSION=$(grep "KAPITAN_VERSION=" tools/Dockerfile.kapitan | cut -d= -f2)" >> ${GITHUB_ENV}
    - name: Build image
      run: docker build -f tools/Dockerfile.kapitan -t ${IMAGE}:${VERSION} tools/
    - name: Push image
      env:
        DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
        DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
      run: |
        docker login docker.io --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}"
        docker push "${IMAGE}:${VERSION}"