Skip to content

v2.0.0 -> build_and_pub_to_ghcr ( 1 ) #1

v2.0.0 -> build_and_pub_to_ghcr ( 1 )

v2.0.0 -> build_and_pub_to_ghcr ( 1 ) #1

---
name: build_and_pub_to_ghcr
# yamllint disable rule:line-length
on:
release:
types: [published]
workflow_dispatch:
# set the run-name
run-name: ${{ github.ref_name }} -> build_and_pub_to_ghcr (
${{ github.run_attempt }}
)
# Defines two custom environment variables for the workflow.
# These are used for the Container registry domain,
# and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build_and_pub_to_ghcr:
name: build_and_pub_to_ghcr
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Echo current date and time
id: datetime
run: |
echo "datetime: $(date '+%Y-%m-%d %H:%M:%S')"
- name: Checkout
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}