Skip to content

GitHub Container Registry #106

GitHub Container Registry

GitHub Container Registry #106

Workflow file for this run

name: GitHub Container Registry
on:
push:
tags: ["v*.*.*"]
schedule:
- cron: "0 4 * * 0"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Fetch tags
run: git pull --tags origin main
- name: Format latest tag for Docker
run: |
git log --pretty=tformat:"%h %s" | head -n 1
t="$(git tag -l | sort -V | tail -n 1)"
echo "LVER=$t" | tee -a "$GITHUB_ENV"
echo "MVER=${t%.*}" | tee -a "$GITHUB_ENV"
echo "SVER=${t%%.*}" | tee -a "$GITHUB_ENV"
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
password: ${{secrets.GITHUB_TOKEN}}
registry: ghcr.io
username: ${{github.actor}}
- uses: docker/build-push-action@v5
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
pull: true
push: true
tags: |
ghcr.io/${{github.repository}}:latest
ghcr.io/${{github.repository}}:${{env.LVER}}
ghcr.io/${{github.repository}}:${{env.MVER}}
ghcr.io/${{github.repository}}:${{env.SVER}}