-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (61 loc) · 1.96 KB
/
merge_multiarch_images.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
61
62
63
64
65
66
67
68
69
name: Merge multiplatform images
on:
workflow_call:
inputs:
image_name:
description: 'Name of the image to build'
required: true
type: string
image_tag_prefix:
description: 'Prefix of the image tag'
required: false
type: string
architecture_suffixes:
description: 'Architecture suffixes'
type: string
required: false
default: |
-linux-amd64
-linux-arm64
secrets:
temporary_registry_token:
description: 'GitHub token'
required: true
outputs:
image:
description: 'Full image tag'
value: ${{ jobs.merge.outputs.image }}
jobs:
merge:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
outputs:
image: ${{ steps.set_outputs.outputs.image }}
steps:
- name: Set required environmental variables
run: |
echo "repository_owner_lower=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV
- name: Login to temporary registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.temporary_registry_token}}
- uses: int128/docker-manifest-create-action@v2
name: Merge and push
with:
tags: ghcr.io/${{ env.repository_owner_lower }}/${{ inputs.image_name }}:${{ inputs.image_tag_prefix }}main
suffixes: ${{ inputs.architecture_suffixes}}
- name: Prune old images
uses: actions/delete-package-versions@v5
with:
package-name: ${{ inputs.image_name }}
package-type: 'container'
min-versions-to-keep: 3
delete-only-untagged-versions: 'true'
- name: Set workflow outputs
id: set_outputs
run: |
echo "image=ghcr.io/${{ env.repository_owner_lower }}/${{ inputs.image_name }}:${{ inputs.image_tag_prefix }}main" >> $GITHUB_OUTPUT