Skip to content

v491-dev4

v491-dev4 #333

# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
name: VTS Eventdisplay Docker Image
on:
workflow_dispatch:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches: ["main"]
release:
types: [published]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-vts-eventdisplay-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: 'EventDisplay_v4'
- name: Set build arguments
run: |
if [[ "${{ github.event_name }}" == 'pull_request' ]]; then
echo "BUILD_BRANCH=${GITHUB_HEAD_REF}" >> "$GITHUB_ENV"
else
echo "BUILD_BRANCH=${GITHUB_REF#refs/heads/}" >> "$GITHUB_ENV"
fi
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
build-args: BUILD_BRANCH=${{ env.BUILD_BRANCH }}
push: ${{ github.event_name != 'pull_request' }}
file: ./EventDisplay_v4/dockerfiles/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}