Skip to content

Merge pull request #4 from leroyloren/renovate/actions-checkout-5.x #11

Merge pull request #4 from leroyloren/renovate/actions-checkout-5.x

Merge pull request #4 from leroyloren/renovate/actions-checkout-5.x #11

Workflow file for this run

name: Build and Push to GHCR
# Spustí se pouze jednou pro daný ref, i když přijde více pushů rychle za sebou
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Oprávnění pro workflow
permissions:
contents: read # Potřebné pro checkout kódu
packages: write # <--- KLÍČOVÁ ZMĚNA: Nutné pro nahrávání do GitHub Packages / GHCR
on:
push:
branches:
- 'master'
- 'main' # Přidáno pro případ, že váš fork používá 'main'
tags:
- 'v*.*.*'
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
env:
# <--- ZMĚNA: Dynamické jméno obrazu pro GHCR
# Použije se ghcr.io/VASE_JMENO/NAZEV_REPOZITARE
GHCR_IMAGE: ghcr.io/${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
# <--- ZMĚNA: Přihlášení do GitHub Container Registry (ghcr.io)
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }} # Vaše GitHub jméno
password: ${{ secrets.GITHUB_TOKEN }} # Automaticky generovaný token pro tuto akci
# <--- ZMĚNA: Metadata upravená pro GHCR
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.GHCR_IMAGE }} # Použije se proměnná pro GHCR
tags: |
type=edge
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
labels: |
org.opencontainers.image.title=LibreNMS
org.opencontainers.image.description=Fully featured network monitoring system
org.opencontainers.image.vendor=LibreNMS
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Krok "Build" zůstává stejný, ale použije metadata pro GHCR
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64 # Příklad pro multi-arch build, upravte dle potřeby
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# <--- ZMĚNA: Ověření manifestu na GHCR
- name: Check manifest
if: github.event_name != 'pull_request'
run: |
docker buildx imagetools inspect ${{ env.GHCR_IMAGE }}:${{ steps.meta.outputs.version }}