Skip to content

chore: bump 0.5

chore: bump 0.5 #11

Workflow file for this run

name: Publish OCI
# Only publish if we tagged a new release
on:
push:
tags: ["v*"]
# 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:
GH_REGISTRY: ghcr.io # Github Container Registry
FULL_IMAGE_NAME: ${{ github.repository }} # full image name: owner/image
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
# QEMU for software emulation of multiple platforms
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# Docker buildx/buildkit for multi-platform builds
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Uses the `docker/login-action` action to log in to the Container registry registry
# using the account and password that will publish the packages.
# Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.GH_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about)
# to extract tags and labels that will be applied to the specified image.
# The `id` "meta" allows the output of this step to be referenced in a subsequent step.
# The `images` value provides the base name for the tags and labels.
# tags and labels
- name: Extract metadata (tags, labels) for image ${{ env.FULL_IMAGE_NAME }}
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.GH_REGISTRY }}/${{ env.FULL_IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=pr
type=ref,event=branch
- name: Get fresh build arguments
shell: bash
run: echo -e "BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S')\nGITREF=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
id: get_buildargs
- name: build and push docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
MY_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
MY_BUILTBY=github-action
BUILD_TIME=${{ steps.get_buildargs.outputs.BUILD_TIME }}
GITREF=${{ steps.get_buildargs.outputs.GITREF }}
# This step generates an artifact attestation for the image,
# which is an unforgeable statement about where and how it was built.
# It increases supply chain security for people who consume the image.
# For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
# - name: Generate artifact attestation
# uses: actions/attest-build-provenance@v1
# with:
# subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
# subject-digest: ${{ steps.push.outputs.digest }}
# push-to-registry: true