-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (51 loc) · 1.57 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Build and Publish the Docker Image
on:
workflow_dispatch:
inputs:
publish:
type: boolean
description: Publish the image to the GitHub Container Registry
required: true
default: true
tag:
type: string
description: The tag to use for the image
required: true
default: latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE_NAME: ghcr.io/lobis/geant4:${{ github.event.inputs.tag }}
jobs:
docker-image:
timeout-minutes: 30
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Log in to the GitHub Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CONTAINER_REGISTRY_GITHUB_TOKEN }}
- name: Build Docker image
uses: docker/build-push-action@v3
with:
context: .
push: false
tags: |
${{ env.IMAGE_NAME }}
labels: |
maintainer.name=Luis Antonio Obis Aparicio
maintainer.email=luis.antonio.obis@gmail.com
org.opencontainers.image.source=${{ github.repository }}
- name: Test image
run: |
docker run --rm ${{ env.IMAGE_NAME }} -c 'from geant4 import Application; Application().setup_manager()'
- name: Publish
run: docker push ${{ env.IMAGE_NAME }}
if: ${{ github.event.inputs.publish }}