name: Build and Push Docker Images on: push: branches: [ main, ci ] paths: - '*/Dockerfile' - '.gitea/workflows/docker-build.yml' jobs: build-rust-latest: runs-on: ubuntu-latest container: git.hofer.link/philipp/ci-images:rust-latest #if: github.event_name == 'push' && contains(github.event.commits[0].modified, 'rust-latest/Dockerfile') steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to Gitea Container Registry uses: docker/login-action@v2 with: registry: git.hofer.link username: ${{ secrets.USERNAME_GITEA }} password: ${{ secrets.PASSWORD_GITEA }} - name: Build and push rust-latest uses: docker/build-push-action@v4 with: context: ./rust-latest push: true tags: git.hofer.link/philipp/ci-images:rust-latest # Add more jobs for other images following the same pattern # build-another-image: # runs-on: ubuntu-latest # if: github.event_name == 'push' && contains(github.event.commits[0].modified, 'another-image/Dockerfile') # steps: # - name: Checkout code # uses: actions/checkout@v3 # # - name: Set up Docker Buildx # uses: docker/setup-buildx-action@v2 # # - name: Login to Gitea Container Registry # uses: docker/login-action@v2 # with: # registry: git.hofer.link # username: ${{ secrets.GITEA_USERNAME }} # password: ${{ secrets.GITEA_PASSWORD }} # # - name: Build and push another-image # uses: docker/build-push-action@v4 # with: # context: ./another-image # push: true # tags: git.hofer.link/philipp/ci-images:another-image