This commit is contained in:
ChrispyBacon-dev 2025-05-25 22:57:21 +02:00
parent 21cbd8388b
commit 912c4c6108
2 changed files with 33 additions and 74 deletions

View file

@ -13,7 +13,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# .github/workflows/docker-build.yml
name: Docker Image Build and Push (Conditional Arch)
on:
@ -24,7 +23,7 @@ on:
pull_request:
branches:
- "stable"
# - "unstable" # Optional: Decide if PRs to nightly should trigger
- "unstable"
jobs:
build:
@ -34,7 +33,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetches all history and tags, necessary for semver tag detection
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@ -53,32 +52,19 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: alplat/dockflare # Your Docker image name
images: alplat/dockflare
tags: |
# --- ADDED THIS LINE ---
# Create Docker tag from Git SemVer tags (e.g., v1.3.0 -> 1.3.0)
type=semver,pattern={{version}}
# --- Keep existing rules ---
# Create 'latest' tag for stable branch pushes
type=ref,event=branch,pattern=stable,value=latest
# Create 'unstable' tag for unstable branch pushes
type=ref,event=branch,pattern=unstable,value=unstable
# Create tag based on short commit SHA
type=sha,format=short
- name: Build and Push Docker Image (Multi-Arch)
uses: docker/build-push-action@v5
with:
context: ./dockflare
# Build for multiple architectures
platforms: linux/amd64 #,linux/arm64 # Enable multi-architecture builds
# Push only on direct pushes to stable or unstable branches
platforms: linux/amd64 #,linux/arm64
push: ${{ github.event_name == 'push' && (github.ref_name == 'stable' || github.ref_name == 'unstable') }}
# Use all tags generated by the metadata action
tags: ${{ steps.meta.outputs.tags }}
# Use labels generated by the metadata action
labels: ${{ steps.meta.outputs.labels }}
# Consider enabling caching once it works
# cache-from: type=gha
# cache-to: type=gha,mode=max
labels: ${{ steps.meta.outputs.labels }}