This is an automated email from the ASF dual-hosted git repository.
davidarthur pushed a commit to branch markdown
in repository https://gitbox.apache.org/repos/asf/kafka-site.git
The following commit(s) were added to refs/heads/markdown by this push:
new 8a1084453 initial checkin of hugo build action
8a1084453 is described below
commit 8a10844531d0e0a4328a07310b090d07e7bc0458
Author: David Arthur <[email protected]>
AuthorDate: Mon Oct 27 16:24:53 2025 -0500
initial checkin of hugo build action
---
.github/workflows/build-prod-image.yml | 104 +++++++++++++++++++++++++++++++++
1 file changed, 104 insertions(+)
diff --git a/.github/workflows/build-prod-image.yml
b/.github/workflows/build-prod-image.yml
new file mode 100644
index 000000000..4018ae3b5
--- /dev/null
+++ b/.github/workflows/build-prod-image.yml
@@ -0,0 +1,104 @@
+name: Build and Push Production Image
+
+on:
+ push:
+ branches: [ markdown ]
+ workflow_dispatch:
+ inputs:
+ target_branches:
+ description: 'Comma-separated list of branches to build (e.g.,
markdown,main)'
+ required: false
+ default: 'markdown,main'
+ type: string
+
+env:
+ # GitHub Container Registry
+ REGISTRY: ghcr.io
+ IMAGE_NAME: ${{ github.repository }}
+
+jobs:
+ build-and-push:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Log in to Container Registry
+ uses: docker/login-action@v3
+ with:
+ registry: ${{ env.REGISTRY }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Extract metadata
+ id: meta
+ uses: docker/metadata-action@v5
+ with:
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+ tags: |
+ type=ref,event=branch
+ type=ref,event=pr
+ type=sha,prefix={{branch}}-
+ type=raw,value=latest,enable={{is_default_branch}}
+ type=raw,value=prod-{{branch}}
+ type=raw,value=prod-{{date 'YYYYMMDD-HHmmss'}}
+ type=raw,value=prod-{{sha}},enable={{is_default_branch}}
+
+ - name: Build Hugo site
+ run: |
+ # Build the site using the multi-platform Hugo image
+ docker run --rm -v $(pwd):/src
hvishwanath/hugo:v0.123.7-ext-multiplatform \
+ --minify \
+ --destination output
+
+ - name: Verify build output
+ run: |
+ echo "Build output contents:"
+ ls -la output/
+ echo "HTML files found:"
+ find output/ -name "*.html" | head -10
+
+ - name: Build and push production image
+ uses: docker/build-push-action@v5
+ with:
+ context: .
+ file: ./Dockerfile.prod
+ platforms: linux/amd64,linux/arm64
+ push: true
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
+
+ - name: Create deployment summary
+ run: |
+ echo "## Production Image Deployment Summary" >> $GITHUB_STEP_SUMMARY
+ echo "- **Source Branch**: ${{ github.ref_name }}" >>
$GITHUB_STEP_SUMMARY
+ echo "- **Commit**: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
+ echo "- **Registry**: ${{ env.REGISTRY }}" >> $GITHUB_STEP_SUMMARY
+ echo "- **Image**: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" >>
$GITHUB_STEP_SUMMARY
+ echo "- **Tags**: ${{ steps.meta.outputs.tags }}" >>
$GITHUB_STEP_SUMMARY
+ echo "- **Build Time**: $(date)" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "### Build Output" >> $GITHUB_STEP_SUMMARY
+ echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
+ ls -la output/ 2>/dev/null || echo "No output directory found" >>
$GITHUB_STEP_SUMMARY
+ echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "### Image Usage" >> $GITHUB_STEP_SUMMARY
+ echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
+ echo "# Pull the image" >> $GITHUB_STEP_SUMMARY
+ echo "docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" >>
$GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "# Run the container" >> $GITHUB_STEP_SUMMARY
+ echo "docker run -p 8080:80 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME
}}:latest" >> $GITHUB_STEP_SUMMARY
+ echo "\`\`\`" >> $GITHUB_STEP_SUMMARY