Skip to content

Merge pull request #59 from SilverKnightKMA/dependabot/npm_and_yarn/d… #99

Merge pull request #59 from SilverKnightKMA/dependabot/npm_and_yarn/d…

Merge pull request #59 from SilverKnightKMA/dependabot/npm_and_yarn/d… #99

Workflow file for this run

name: Build and Push Docker Image
on:
pull_request:
release:
types: [published]
workflow_dispatch:
inputs:
tag_name:
description: 'Manual Tag'
required: false
default: 'manual'
type: string
force_build:
description: 'Force build image'
required: true
default: false
type: boolean
push:
branches:
- 'main'
tags:
- '*.*.*'
paths-ignore:
- 'README.md'
- '.github/**'
env:
REGISTRY: ghcr.io
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'workflow_dispatch' || inputs.force_build == true }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to the Container Registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v6
with:
images: |
${{ env.REGISTRY == 'ghcr.io' && format('{0}/{1}', env.REGISTRY, github.repository) || '' }}
${{ env.REGISTRY != 'ghcr.io' && env.REGISTRY != 'docker.io' && format('{0}/{1}', env.REGISTRY, github.repository) || '' }}
${{ env.REGISTRY == 'docker.io' && format('{0}/{1}', github.repository_owner, github.event.repository.name) || '' }}
tags: |
type=raw,value=dev,enable=${{ github.event_name == 'push' }}
type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }}
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
type=raw,value=v${{ github.event.release.tag_name }},enable=${{ github.event_name == 'release' }}
type=raw,value=${{ inputs.tag_name }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=raw,value=${{ github.sha }},enable=true
type=raw,value=edge,enable=${{ github.event_name == 'pull_request' }}
type=ref,event=branch,enable=${{ !endsWith(github.ref, 'main') }}
type=match,pattern=\d.\d.\d$,priority=901
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max