Skip to content

Build and Push Docker Image to GHCR #1

Build and Push Docker Image to GHCR

Build and Push Docker Image to GHCR #1

name: Build and Push Docker Image to GHCR
on:
repository_dispatch:
types: [trigger_docker_build]
workflow_dispatch:
inputs:
user_defined_tag:
description: 'Custom tag for the Docker image'
required: true
tagAsLatest:
description: 'Tag as latest ?'
required: true
default: 'false'
type: choice
options:
- 'true'
- 'false'
jobs:
build_docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image to GHCR
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/onlyfans:${{ github.event.inputs.user_defined_tag != '' && github.event.inputs.user_defined_tag || github.event.client_payload.latest_tag }}
${{ github.event.inputs.tagAsLatest == 'true' || github.event.client_payload.tag_as_latest == 'true' && 'ghcr.io/${{ github.repository_owner }}/onlyfans:latest' || '' }}