-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (72 loc) · 2.44 KB
/
Copy path___build_variants.yml
File metadata and controls
75 lines (72 loc) · 2.44 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
name: _Build variants
on:
workflow_call:
inputs:
types_directory:
type: string
required: false
default: "types"
matrix_include:
type: string
required: true
runs-on:
type: string
required: false
default: "ubuntu-latest"
platform:
type: string
required: false
default: "linux/amd64/v3"
enable_minor:
type: boolean
required: false
default: false
permissions:
packages: write
jobs:
build:
name: Build variant images
runs-on: ${{ inputs.runs-on }}
strategy:
max-parallel: 3
matrix:
include: ${{ fromJson(inputs.matrix_include) }}
steps:
- name: Determine informations
id: determine_informations
env:
BASE_TAG: "ghcr.io/${{ github.repository }}:${{ matrix.tag }}${{ matrix.variant }}"
BASE_TAG_SHORT: "ghcr.io/${{ github.repository }}:${{ matrix.minor }}${{ matrix.variant }}"
run: |
echo "base=${BASE_TAG}-base" >> $GITHUB_OUTPUT
echo "tags=${BASE_TAG}-${{ matrix.types }}${{ inputs.enable_minor && format(',{0}-{1}', env.BASE_TAG_SHORT, matrix.types) }}" >> $GITHUB_OUTPUT
- name: Get Debian version
id: debian_version
run: |
docker pull "${{ steps.determine_informations.outputs.base }}"
echo value="$(docker run --rm -i "${{ steps.determine_informations.outputs.base }}" sh -c '. /etc/os-release && echo ${VERSION_ID}')" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v4
with:
submodules: false
fetch-depth: 1
- name: Setup Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Packages - Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push image
uses: docker/build-push-action@v6
with:
context: "${{ inputs.types_directory }}/${{ matrix.types }}"
push: true
pull: true
github-token: ${{ secrets.GITHUB_TOKEN }}
tags: ${{ steps.determine_informations.outputs.tags }}
build-args: |
PLATFORM=${{ inputs.platform }}
BASE_IMAGE=${{ steps.determine_informations.outputs.base }}
DEBIAN_VERSION=${{ steps.debian_version.outputs.value }}