Repository navigation
97 lines (88 loc) · 3.04 KB
/
Copy pathprepare.yaml
File metadata and controls
97 lines (88 loc) · 3.04 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# SPDX-FileCopyrightText: 2026 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0
name: Prepare
on:
workflow_call:
inputs:
container_image:
required: true
type: string
ref:
required: true
type: string
ref_name:
required: true
type: string
permissions:
contents: read
packages: write
jobs:
container:
name: "Prepare Container Dev Images [${{ matrix.name }}]"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: ubuntu
docker_file: packaging/docker/Dockerfile.ubuntu
image_name: ubuntu
- name: debian
docker_file: packaging/docker/Dockerfile.debian
image_name: debian
- name: rocky
docker_file: packaging/docker/Dockerfile.rocky
image_name: rocky
- name: rocky9
docker_file: packaging/docker/Dockerfile.rocky9
image_name: rocky9
- name: fedora
docker_file: packaging/docker/Dockerfile.fedora
image_name: fedora
- name: fedora-minimal
docker_file: packaging/docker/Dockerfile.fedora-minimal
image_name: fedora-minimal
- name: fedora-vscode
docker_file: packaging/docker/Dockerfile.fedora
image_name: vscode
target: dev-vscode
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ inputs.ref }}
allow-unsafe-pr-checkout: true
fetch-depth: 0
submodules: recursive
- name: Login to Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build Image
uses: docker/setup-buildx-action@v4
- name: Compute safe ref Tag
id: ref
env:
REF_NAME: ${{ inputs.ref_name }}
run: echo "tag=${REF_NAME//\//-}" >> "$GITHUB_OUTPUT"
- name: Build and Push Image
uses: docker/build-push-action@v7
with:
context: .
file: ${{ matrix.docker_file }}
target: ${{ matrix.target || 'dev' }}
push: true
cache-from: type=gha,scope=dev-${{ matrix.image_name }}
cache-to: ${{ github.event_name != 'pull_request_target' && format('type=gha,mode=max,scope=dev-{0}', matrix.image_name) || '' }}
tags: |
${{ inputs.container_image }}/dev-${{ matrix.image_name }}:${{ inputs.ref }}
${{ inputs.container_image }}/dev-${{ matrix.image_name }}:${{ steps.ref.outputs.tag }}
- name: Publish fedora dev alias
if: matrix.name == 'fedora'
run: |
docker buildx imagetools create \
-t "${{ inputs.container_image }}/dev:${{ inputs.ref }}" \
-t "${{ inputs.container_image }}/dev:${{ steps.ref.outputs.tag }}" \
"${{ inputs.container_image }}/dev-fedora:${{ inputs.ref }}"