Skip to content

Publish Docker Image #12

Publish Docker Image

Publish Docker Image #12

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Publish Docker Image"
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
tag:
type: "string"
description: "{string} Tag."
required: true
latest:
type: "choice"
description: "{boolean} Latest."
required: false
default: "false"
options:
- "false"
- "true"
jobs:
ghp:
name: "GitHub Packages"
permissions:
contents: "read"
packages: "write"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v4"
- name: "Setup Docker QEMU"
uses: "docker/setup-qemu-action@v3"
- name: "Setup Docker Buildx"
uses: "docker/setup-buildx-action@v3"
- name: "Sign In To GitHub Packages"
uses: "docker/login-action@v3"
with:
registry: "ghcr.io"
username: "${{github.actor}}"
password: "${{secrets.GITHUB_TOKEN}}"
- name: "Resolve Metadata"
id: "metadata"
uses: "docker/metadata-action@v5"
with:
images: |-
name=ghcr.io/${{github.repository}}
tags: |-
type=raw,enable=${{inputs.tag != ''}},value=${{inputs.tag}}
type=raw,enable=${{inputs.latest == 'true'}},value=latest
type=semver,enable=${{inputs.tag == ''}},pattern={{version}}
type=semver,enable=${{inputs.tag == ''}},pattern={{major}}.{{minor}}.{{patch}}
type=semver,enable=${{inputs.tag == ''}},pattern={{major}}.{{minor}}
type=semver,enable=${{inputs.tag == ''}},pattern={{major}}
labels: |-
org.opencontainers.image.authors=${{github.repository_owner}}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.title=Send Discord Webhook (GitHub Action) Image
org.opencontainers.image.description=A Docker image for Send Discord Webhook (GitHub Action) to send Discord webhook.
- name: "Build & Publish Docker Image"
uses: "docker/build-push-action@v6"
with:
context: "./"
file: "Dockerfile"
labels: "${{steps.metadata.outputs.labels}}"
platforms: |-
linux/amd64
pull: "true"
push: "true"
tags: "${{steps.metadata.outputs.tags}}"
cache-from: |-
type=gha
cache-to: |-
type=gha,mode=max
- name: "List Docker Image"
run: |-
docker image ls --all --digests --no-trunc