Skip to content

Build and Publish Docker Image #22

Build and Publish Docker Image

Build and Publish Docker Image #22

Workflow file for this run

name: Build and Publish Docker Image
on:
push:
branches:
- main
paths:
- 'dockerfiles/dnf/Dockerfile'
tags:
- 'v*.*.*'
pull_request:
branches:
- main
paths:
- 'dockerfiles/dnf/Dockerfile'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
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/dnf/Dockerfile
push: true
tags: >

Check failure on line 50 in .github/workflows/build.yaml

View workflow run for this annotation

GitHub Actions / Build and Publish Docker Image

Invalid workflow file

The workflow is not valid. .github/workflows/build.yaml (Line: 50, Col: 23): Unexpected symbol: '?'. Located at position 43 within expression: startsWith(github.ref, 'refs/tags/') ? 'ghcr.io/openchami/image-build:v' + steps.extract_version.outputs.version : (startsWith(github.ref, 'refs/pull/') ? 'ghcr.io/openchami/image-build:latest-prbuild' : '')
${{ startsWith(github.ref, 'refs/tags/')
? 'ghcr.io/openchami/image-build:v' + steps.extract_version.outputs.version
: (startsWith(github.ref, 'refs/pull/')
? 'ghcr.io/openchami/image-build:latest-prbuild'
: '') }}