Skip to content

Merge pull request #3 from midirhee12/main #8

Merge pull request #3 from midirhee12/main

Merge pull request #3 from midirhee12/main #8

Workflow file for this run

name: "GHCR - Build and Push Docker Image"
on:
push:
branches: ["main"]
tags: ["*"]
pull_request:
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
fetch-depth: 0
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/allthingslinux/tux
flavor: |
latest=${{ github.ref_type == 'tag' }}
tags: |
type=sha,enable={{is_default_branch}},event=push
type=pep440,pattern={{version}},event=tag
type=ref,event=pr
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: github.ref_type == 'tag'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: ${{ github.ref_type == 'tag' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
context: .
provenance: false
build-args: |
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
- name: Remove old images
uses: actions/delete-package-versions@v5
with:
package-name: 'tux'
package-type: 'container'
min-versions-to-keep: 10