Skip to content

Update example version #53

Update example version

Update example version #53

Workflow file for this run

name: Build and publish OCI image
on:
push:
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
env:
REGISTRY: docker.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
name: Build and push OCI image to docker.io registry
runs-on: ubuntu-22.04
steps:
- name: Check out the repo
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.workflow_run.head_branch }}
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
build-args: "RELEASE=${{ steps.tag.outputs.tag }}"
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build and push Docker image running as root
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile-root
build-args: "RELEASE=${{ steps.tag.outputs.tag }}"
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-root
labels: ${{ steps.meta.outputs.labels }}