1
+ name : generate-release
2
+
3
+ on :
4
+ release :
5
+ types : [ published ]
6
+ workflow_dispatch :
7
+
8
+ env :
9
+ REGISTRY : docker.io
10
+ IMAGE_NAME : ${{ github.repository }}
11
+ platforms : linux/amd64,linux/arm64
12
+ DEFAULT_TYPE : " external"
13
+
14
+ jobs :
15
+ build-and-push-image :
16
+ runs-on : ubuntu-latest
17
+
18
+ strategy :
19
+ matrix :
20
+ type : [ local, external ]
21
+
22
+ permissions :
23
+ contents : read
24
+ packages : write
25
+
26
+ outputs :
27
+ version : ${{ steps.version.outputs.version }}
28
+
29
+ steps :
30
+ - name : Free Disk Space (Ubuntu)
31
+ uses : jlumbroso/free-disk-space@main
32
+ with :
33
+ tool-cache : false
34
+ android : true
35
+ dotnet : true
36
+ haskell : true
37
+ large-packages : true
38
+ docker-images : false
39
+ swap-storage : true
40
+
41
+ - name : Checkout repository
42
+ uses : actions/checkout@v4
43
+
44
+ - name : Set up QEMU
45
+ uses : docker/setup-qemu-action@v3
46
+
47
+ - name : Set up Docker Buildx
48
+ uses : docker/setup-buildx-action@v3
49
+
50
+ - name : Log in to Docker Hub
51
+ uses : docker/login-action@v3
52
+ with :
53
+ username : ${{ secrets.DOCKER_USERNAME }}
54
+ password : ${{ secrets.DOCKER_PASSWORD }}
55
+
56
+ - name : Extract metadata (tags, labels) for Docker
57
+ id : meta
58
+ uses : docker/metadata-action@v5
59
+ with :
60
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
61
+ tags : |
62
+ type=semver,pattern={{version}},enable=${{ matrix.type == env.DEFAULT_TYPE }}
63
+ type=semver,pattern={{version}}-${{ matrix.type }}
64
+ type=semver,pattern={{major}}.{{minor}},enable=${{ matrix.type == env.DEFAULT_TYPE }}
65
+ type=semver,pattern={{major}}.{{minor}}-${{ matrix.type }}
66
+ type=raw,value=latest,enable=${{ matrix.type == env.DEFAULT_TYPE }}
67
+ type=sha
68
+ flavor : |
69
+ latest=false
70
+
71
+ - name : Build and push Docker image
72
+ uses : docker/build-push-action@v6
73
+ with :
74
+ context : .
75
+ file : Dockerfile.${{ matrix.type }}
76
+ platforms : ${{ env.platforms }}
77
+ push : true
78
+ tags : ${{ steps.meta.outputs.tags }}
79
+ labels : ${{ steps.meta.outputs.labels }}
80
+
81
+ - name : Version output
82
+ id : version
83
+ run : echo "version=${{ steps.meta.outputs.version }}" >> "$GITHUB_OUTPUT"
0 commit comments