[PR #4] [CLOSED] Add flexible Docker registry strategy support with separate workflows #26

Closed
opened 2026-06-08 09:03:54 +00:00 by ryangr0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/webgrip/workflows/pull/4
Author: @Copilot
Created: 8/31/2025
Status: Closed

Base: mainHead: copilot/fix-3


📝 Commits (4)

  • 04c6029 Initial plan
  • 5ae9546 Add GitHub Container Registry support to Docker workflows
  • 8e6dfd8 Fix YAML formatting and complete GHCR implementation
  • efe8739 Implement separate registry workflows with conditional strategy selection

📊 Changes

9 files changed (+705 additions, -12 deletions)

View changed files

.github/composite-actions/docker-build-push-dockerhub/action.yml (+55 -0)
.github/composite-actions/docker-build-push-dual/action.yml (+101 -0)
.github/composite-actions/docker-build-push-ghcr/action.yml (+94 -0)
.github/composite-actions/docker-build-push-smart/action.yml (+93 -0)
📝 .github/workflows/docker-build-and-push.yml (+91 -5)
.github/workflows/docker-registry-strategy-examples.yml (+112 -0)
📝 .github/workflows/helm-chart-deploy.yml (+3 -3)
📝 .github/workflows/helm-charts-deploy.yml (+8 -4)
DOCKER_REGISTRY_GUIDE.md (+148 -0)

📄 Description

This PR implements a flexible multi-registry approach for Docker image publishing, allowing users to choose between GitHub Container Registry (GHCR), Docker Hub, both, or neither based on available secrets and project needs.

New Architecture

Instead of modifying the existing docker-build-push action, this creates separate composite actions for different registry scenarios:

  • docker-build-push-ghcr - GitHub Container Registry only (no Docker secrets needed)
  • docker-build-push-dockerhub - Docker Hub only (requires Docker credentials)
  • docker-build-push-dual - Both registries (requires Docker credentials)
  • docker-build-push-smart - Auto-detection based on available secrets

Smart Strategy Selection

The main docker-build-and-push.yml workflow now supports a registry-strategy input:

jobs:
  docker:
    uses: webgrip/workflows/.github/workflows/docker-build-and-push.yml@main
    with:
      docker-tags: "latest"
      registry-strategy: 'auto'  # or 'ghcr', 'dockerhub', 'dual', 'legacy', 'none'
    secrets:
      DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}  # Optional
      DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}      # Optional

Available Strategies:

  • auto (default) - Automatically chooses based on available secrets
  • ghcr - GHCR only, uses GitHub token automatically
  • dockerhub - Docker Hub only, requires Docker credentials
  • dual - Both registries, requires Docker credentials
  • legacy - Original behavior for backward compatibility
  • none - Build only, no push

Tag Generation Examples

The system intelligently handles tag conversion:

# Auto-generates appropriate registry prefixes
"latest" → "ghcr.io/owner/repo:latest" (GHCR strategy)
"latest" → "ghcr.io/owner/repo:latest" + "owner/repo:latest" (dual strategy)
"myorg/app:v1.0" → "ghcr.io/myorg/app:v1.0" + "myorg/app:v1.0" (dual strategy)

Migration Benefits

  • Maximum Flexibility: Choose the right strategy for each project
  • Zero Breaking Changes: Existing workflows continue working unchanged
  • Gradual Migration: Move from Docker Hub to GHCR at your own pace
  • Cost Optimization: Reduce Docker Hub usage and rate limiting
  • Security: GHCR inherits repository-level permissions
  • Separation of Concerns: Each registry strategy has dedicated implementation

Helm Workflow Updates

Updated helm-chart-deploy.yml to use ghcr.io/webgrip/helm-deploy:latest with GitHub token authentication, removing dependency on Docker Hub credentials for container access.

Documentation

Comprehensive documentation and examples provided:

  • DOCKER_REGISTRY_GUIDE.md - Complete usage guide and migration instructions
  • docker-registry-strategy-examples.yml - Working examples of all strategies

Fixes #3 with a more flexible, user-controlled approach.


Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/webgrip/workflows/pull/4 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 8/31/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `copilot/fix-3` --- ### 📝 Commits (4) - [`04c6029`](https://github.com/webgrip/workflows/commit/04c6029587899b4edaae71f0e0ea3c832f146529) Initial plan - [`5ae9546`](https://github.com/webgrip/workflows/commit/5ae9546744afdbaa95b1e6fcf133f3be98b72030) Add GitHub Container Registry support to Docker workflows - [`8e6dfd8`](https://github.com/webgrip/workflows/commit/8e6dfd8e63bc648be9a2340dd27032e7e1bbbcbd) Fix YAML formatting and complete GHCR implementation - [`efe8739`](https://github.com/webgrip/workflows/commit/efe873920ffd856dee4f38c0b837fcc063bcb4d7) Implement separate registry workflows with conditional strategy selection ### 📊 Changes **9 files changed** (+705 additions, -12 deletions) <details> <summary>View changed files</summary> ➕ `.github/composite-actions/docker-build-push-dockerhub/action.yml` (+55 -0) ➕ `.github/composite-actions/docker-build-push-dual/action.yml` (+101 -0) ➕ `.github/composite-actions/docker-build-push-ghcr/action.yml` (+94 -0) ➕ `.github/composite-actions/docker-build-push-smart/action.yml` (+93 -0) 📝 `.github/workflows/docker-build-and-push.yml` (+91 -5) ➕ `.github/workflows/docker-registry-strategy-examples.yml` (+112 -0) 📝 `.github/workflows/helm-chart-deploy.yml` (+3 -3) 📝 `.github/workflows/helm-charts-deploy.yml` (+8 -4) ➕ `DOCKER_REGISTRY_GUIDE.md` (+148 -0) </details> ### 📄 Description This PR implements a flexible multi-registry approach for Docker image publishing, allowing users to choose between GitHub Container Registry (GHCR), Docker Hub, both, or neither based on available secrets and project needs. ## New Architecture Instead of modifying the existing docker-build-push action, this creates separate composite actions for different registry scenarios: - **`docker-build-push-ghcr`** - GitHub Container Registry only (no Docker secrets needed) - **`docker-build-push-dockerhub`** - Docker Hub only (requires Docker credentials) - **`docker-build-push-dual`** - Both registries (requires Docker credentials) - **`docker-build-push-smart`** - Auto-detection based on available secrets ## Smart Strategy Selection The main `docker-build-and-push.yml` workflow now supports a `registry-strategy` input: ```yaml jobs: docker: uses: webgrip/workflows/.github/workflows/docker-build-and-push.yml@main with: docker-tags: "latest" registry-strategy: 'auto' # or 'ghcr', 'dockerhub', 'dual', 'legacy', 'none' secrets: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} # Optional DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} # Optional ``` **Available Strategies:** - `auto` (default) - Automatically chooses based on available secrets - `ghcr` - GHCR only, uses GitHub token automatically - `dockerhub` - Docker Hub only, requires Docker credentials - `dual` - Both registries, requires Docker credentials - `legacy` - Original behavior for backward compatibility - `none` - Build only, no push ## Tag Generation Examples The system intelligently handles tag conversion: ```yaml # Auto-generates appropriate registry prefixes "latest" → "ghcr.io/owner/repo:latest" (GHCR strategy) "latest" → "ghcr.io/owner/repo:latest" + "owner/repo:latest" (dual strategy) "myorg/app:v1.0" → "ghcr.io/myorg/app:v1.0" + "myorg/app:v1.0" (dual strategy) ``` ## Migration Benefits - **Maximum Flexibility**: Choose the right strategy for each project - **Zero Breaking Changes**: Existing workflows continue working unchanged - **Gradual Migration**: Move from Docker Hub to GHCR at your own pace - **Cost Optimization**: Reduce Docker Hub usage and rate limiting - **Security**: GHCR inherits repository-level permissions - **Separation of Concerns**: Each registry strategy has dedicated implementation ## Helm Workflow Updates Updated `helm-chart-deploy.yml` to use `ghcr.io/webgrip/helm-deploy:latest` with GitHub token authentication, removing dependency on Docker Hub credentials for container access. ## Documentation Comprehensive documentation and examples provided: - `DOCKER_REGISTRY_GUIDE.md` - Complete usage guide and migration instructions - `docker-registry-strategy-examples.yml` - Working examples of all strategies Fixes #3 with a more flexible, user-controlled approach. <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/webgrip/workflows/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
ryangr0 2026-06-08 09:03:54 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
webgrip/workflows#26
No description provided.