Skip to content

Commit bb14974

Browse files
committed
feat: Add GitHub Action for feature branch Docker builds
- Automated Docker builds for feature/zone-configuration-improvements branch - Multi-platform support (linux/amd64, linux/arm64) - Feature-specific tagging: feature-zone-config and feature-zone-config-{sha} - Container startup validation and PR build checks - Reuses existing Docker Hub secrets and infrastructure
1 parent 02944c5 commit bb14974

1 file changed

Lines changed: 139 additions & 0 deletions

File tree

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# GitHub Action for Feature Branch Docker Builds
2+
# Builds and pushes Docker images for feature branch development
3+
4+
name: Build Feature Branch Docker
5+
6+
on:
7+
push:
8+
branches:
9+
- 'feature/zone-configuration-improvements'
10+
pull_request:
11+
branches:
12+
- 'feature/zone-configuration-improvements'
13+
workflow_dispatch:
14+
inputs:
15+
force_build:
16+
description: 'Force rebuild even without changes'
17+
required: false
18+
default: false
19+
type: boolean
20+
21+
# Environment variables for Docker registry and image naming
22+
env:
23+
REGISTRY: docker.io
24+
IMAGE_NAME: docbobo/roon-extension-denon
25+
FEATURE_TAG: feature-zone-config
26+
27+
jobs:
28+
build-feature-branch:
29+
name: Build Feature Branch Docker Image
30+
runs-on: ubuntu-latest
31+
32+
# Only run on push to feature branch or manual dispatch
33+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
34+
35+
environment: production
36+
permissions:
37+
packages: write
38+
contents: read
39+
attestations: write
40+
id-token: write
41+
42+
steps:
43+
- name: Check out the repo
44+
uses: actions/checkout@v4
45+
46+
- name: Set up QEMU
47+
uses: docker/setup-qemu-action@v3
48+
49+
- name: Set up Docker Buildx
50+
uses: docker/setup-buildx-action@v3
51+
52+
- name: Log in to Docker Hub
53+
uses: docker/login-action@v3
54+
with:
55+
username: ${{ secrets.DOCKER_USERNAME }}
56+
password: ${{ secrets.DOCKER_PASSWORD }}
57+
58+
- name: Generate Docker metadata
59+
id: meta
60+
uses: docker/metadata-action@v5
61+
with:
62+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
63+
tags: |
64+
type=raw,value=${{ env.FEATURE_TAG }}
65+
type=raw,value=${{ env.FEATURE_TAG }}-{{sha}}
66+
type=ref,event=branch,prefix=${{ env.FEATURE_TAG }}-
67+
labels: |
68+
org.opencontainers.image.title=Roon Extension Denon (Feature Branch)
69+
org.opencontainers.image.description=Roon Volume Control Extension for Denon/Marantz receivers (Zone Configuration Feature)
70+
org.opencontainers.image.vendor=docbobo
71+
org.opencontainers.image.url=https://github.com/docbobo/roon-extension-denon
72+
73+
- name: Build and push Docker image
74+
id: build
75+
uses: docker/build-push-action@v6
76+
with:
77+
platforms: linux/amd64,linux/arm64
78+
context: .
79+
file: ./Dockerfile
80+
push: true
81+
tags: ${{ steps.meta.outputs.tags }}
82+
labels: ${{ steps.meta.outputs.labels }}
83+
cache-from: type=gha
84+
cache-to: type=gha,mode=max
85+
86+
- name: Validate Docker image
87+
run: |
88+
echo "✅ Docker image built successfully"
89+
echo "📦 Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
90+
echo "🏷️ Tags: ${{ steps.meta.outputs.tags }}"
91+
echo "🔗 Docker Hub: https://hub.docker.com/r/${{ env.IMAGE_NAME }}/tags"
92+
93+
- name: Test container startup
94+
run: |
95+
echo "🧪 Testing container startup..."
96+
docker run --rm -d --name test-container ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.FEATURE_TAG }} &
97+
sleep 5
98+
if docker ps | grep -q test-container; then
99+
echo "✅ Container started successfully"
100+
docker stop test-container
101+
else
102+
echo "❌ Container failed to start"
103+
docker logs test-container || true
104+
exit 1
105+
fi
106+
107+
# Optional job for pull requests - just validate build without push
108+
validate-pr:
109+
name: Validate PR Build
110+
runs-on: ubuntu-latest
111+
112+
if: github.event_name == 'pull_request'
113+
114+
permissions:
115+
contents: read
116+
117+
steps:
118+
- name: Check out the repo
119+
uses: actions/checkout@v4
120+
121+
- name: Set up Docker Buildx
122+
uses: docker/setup-buildx-action@v3
123+
124+
- name: Build Docker image (no push)
125+
uses: docker/build-push-action@v6
126+
with:
127+
platforms: linux/amd64,linux/arm64
128+
context: .
129+
file: ./Dockerfile
130+
push: false
131+
tags: ${{ env.IMAGE_NAME }}:pr-${{ github.event.number }}
132+
cache-from: type=gha
133+
cache-to: type=gha,mode=max
134+
135+
- name: Validate PR build
136+
run: |
137+
echo "✅ PR build validation completed"
138+
echo "🔍 Build tested for platforms: linux/amd64,linux/arm64"
139+
echo "📋 Ready for feature branch merge"

0 commit comments

Comments
 (0)