Skip to content

Publish Docker image #19

Publish Docker image

Publish Docker image #19

Workflow file for this run

name: Publish Docker image
on:
release:
types: [published]
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- 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.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=tag,enable=true
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
push: true
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:latest
cache-to: type=inline
- name: Remove untagged container images
uses: actions/delete-package-versions@v5
with:
package-name: kompressor
package-type: container
delete-only-untagged-versions: true
min-versions-to-keep: 0