Skip to content

Merge branch 'main' of https://github.com/DiamondLightSource/TomoHub #13

Merge branch 'main' of https://github.com/DiamondLightSource/TomoHub

Merge branch 'main' of https://github.com/DiamondLightSource/TomoHub #13

Workflow file for this run

name: Tomohub
on:
push:
tags:
- 'v*'
jobs:
build_and_deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
# Checkout the repository code
- name: Checkout Code
uses: actions/checkout@v4.2.2
# Generate the image name dynamically
- name: Generate Image Name
run: echo IMAGE_REPOSITORY=ghcr.io/$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]') >> $GITHUB_ENV
# Log in to GitHub Container Registry
- name: Log in to GitHub Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.7.1
# Generate Docker image metadata
- name: Docker Metadata
id: meta
uses: docker/metadata-action@v5.6.1
with:
images: ${{ env.IMAGE_REPOSITORY }}
tags: |
type=ref,event=tag
type=raw,value=latest
# Build and push the Docker image
- name: Build and Push Docker Image
uses: docker/build-push-action@v6.10.0
with:
context: . # DockerFile location
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
load: ${{ !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max