Skip to content

Documentation and Automation #3

Documentation and Automation

Documentation and Automation #3

Workflow file for this run

name: Build and Publish Docker Image
on:
push:
branches:
- main
paths:
- 'dockerfiles/dnf/Dockerfile.minimal'
tags:
- 'v*.*.*'
pull_request:
branches:
- main
paths:
- 'dockerfiles/dnf/Dockerfile.minimal'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from tag
if: startsWith(github.ref, 'refs/tags/')
id: extract_version
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: dockerfiles/Dockerfile.minimal
push: true
tags: |
ghcr.io/openchami/image-build:latest
ghcr.io/openchami/image-build:${{ steps.extract_version.outputs.version }}