Skip to content

Create and publish EMOD image #15

Create and publish EMOD image

Create and publish EMOD image #15

name: Create and publish EMOD image
on:
# Allows manual run from the Actions tab
workflow_dispatch:
inputs:
type:
description: 'Container type'
type: choice
options:
- 'emod_build'
- 'emod_runtime'
version:
description: 'Version tag'
required: true
type: string
default: 'latest'
env:
REGISTRY: ghcr.io
ORG_NAME: emod-hub # Must be lowercase
jobs:
build-and-push-image:
name: Build and push Docker image
runs-on: ubuntu-latest
permissions:
artifact-metadata: write
attestations: write
id-token: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Log in to Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
file: docker/${{ inputs.type }}
push: true
tags: ${{ env.REGISTRY }}/${{ env.ORG_NAME }}/${{ inputs.type }}:${{ inputs.version }}
- name: Generate artifact attestation
uses: actions/attest@v4
with:
subject-name: ${{ env.REGISTRY }}/${{ env.ORG_NAME }}/${{ inputs.type }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true