Skip to content

TEST 36

TEST 36 #50

# TODO: Update to pinned versions
name: Build and Push
on:
push:
paths:
- 'jenkins/**'
- 'dind-agent/**'
branches:
- "master"
tags:
- "v*"
pull_request:
branches:
- "master"
paths:
- 'jenkins/**'
- 'dind-agent/**'
env:
IMAGE_OWNER: ${{ github.repository_owner }}
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- path: ./jenkins
image: caliskanugur/jenkins-server
- path: ./dind-agent
image: caliskanugur/jenkins-agent
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
tags: |
type=ref,event=tag
type=raw,value=head
-
name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ env.IMAGE_OWNER }}
password: ${{ secrets.DOCKER_TOKEN }}
-
name: Build Image
uses: docker/build-push-action@v6
with:
context: ${{ matrix.path }}
push: ${{ github.event_name != 'pull_request' }}
load: ${{ github.event_name == 'pull_request' }}
file: ${{ matrix.path }}/Dockerfile
tags: |
${{ steps.meta.outputs.tags }}