Skip to content

Update main.yml

Update main.yml #89

Workflow file for this run

name: Publish to GHCR
on:
push:
branches:
- release
paths-ignore:
- '**.md'
jobs:
Publish:
runs-on: buildjet-2vcpu-ubuntu-2204-arm
permissions:
contents: read
packages: write
steps:
# this step converts the repository name to lowercase as uppercase is not supported by docker
- name: Format repo slug
uses: actions/github-script@v7
id: repo_slug
with:
result-encoding: string
script: return `ghcr.io/${process.env.GITHUB_REPOSITORY.toLowerCase()}`
- name: Checkout Code
uses: actions/checkout@v4
- name: Login to GHCR
env:
REGISTRY: ghcr.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Extract metadata for Docker GHCR
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Setup buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: linux/arm64/v8
cache-from: type=registry,ref=${{ steps.repo_slug.outputs.result }}:cache
cache-to: type=registry,ref=${{ steps.repo_slug.outputs.result }}:cache,mode=max
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}