Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-push-ghcr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
type=sha
type=raw,value=${{ inputs.branch }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/external-build-push-ghcr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Reusable workflow to build and push docker container to github container registry

on:
workflow_call:
secrets:
GIT_AUTH_TOKEN:
required: false
description: 'PAT to publish image'
inputs:
container-name:
required: true
type: string
context:
required: false
type: string
default: '.'
file:
required: false
type: string
default: 'Dockerfile'
branch:
type: string
default: 'main'

env:
REGISTRY: ghcr.io/clubcedille

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GIT_AUTH_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ inputs.container-name }}
tags: |
type=ref,event=branch
type=sha
type=raw,value=${{ inputs.branch }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ${{ inputs.context }}
file: ${{ inputs.file }}
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
secrets: |
GIT_AUTH_TOKEN = ${{ secrets.GIT_AUTH_TOKEN }}
continue-on-error: true
Loading