build(*): Improve build automation

This commit is contained in:
Josh Creek
2026-02-25 17:51:15 +00:00
parent e852db9559
commit c09089b777
4 changed files with 142 additions and 24 deletions
+4 -18
View File
@@ -1,14 +1,9 @@
name: Docker
name: Docker CI
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- "v*.*.*"
env:
IMAGE_NAME: jcreek23/open-network-diagram
@@ -26,30 +21,21 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: docker.io/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=pr
type=sha,prefix=sha-
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build (PR) / Build+Push (push)
- name: Build (PR validation only)
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: ${{ github.event_name == 'push' }}
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha