1
+ name : release-container-images
2
+
3
+ on :
4
+ release :
5
+ types : [published]
6
+
7
+ permissions :
8
+ contents : read
9
+ packages : write
10
+
11
+ jobs :
12
+ publish-container-image :
13
+
14
+ runs-on : ubuntu-latest
15
+
16
+ strategy :
17
+ fail-fast : false
18
+ matrix :
19
+ apps : [
20
+ ai-service,
21
+ makeline-service,
22
+ order-service,
23
+ product-service,
24
+ store-admin,
25
+ store-front,
26
+ virtual-customer,
27
+ virtual-worker
28
+ ]
29
+
30
+ steps :
31
+ - name : Set environment variables
32
+ id : set-variables
33
+ run : |
34
+ echo "REPOSITORY=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
35
+ echo "IMAGE=${{ matrix.apps }}" >> "$GITHUB_OUTPUT"
36
+ echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> "$GITHUB_OUTPUT"
37
+ echo "CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
38
+
39
+ - name : Env variable output
40
+ id : test-variables
41
+ run : |
42
+ echo ${{ steps.set-variables.outputs.REPOSITORY }}
43
+ echo ${{ steps.set-variables.outputs.IMAGE }}
44
+ echo ${{ steps.set-variables.outputs.VERSION }}
45
+ echo ${{ steps.set-variables.outputs.CREATED }}
46
+
47
+ - name : Checkout code
48
+ uses : actions/checkout@v2
49
+
50
+ - name : Set up Docker Buildx
51
+ uses : docker/setup-buildx-action@v2
52
+
53
+ - name : Login to GitHub Container Registry
54
+ uses : docker/login-action@v1
55
+ with :
56
+ registry : ghcr.io
57
+ username : ${{ github.actor }}
58
+ password : ${{ github.token }}
59
+
60
+ - name : Build and push
61
+ uses : docker/build-push-action@v2
62
+ with :
63
+ context : src/${{ matrix.apps }}
64
+ file : src/${{ matrix.apps }}/Dockerfile
65
+ platforms : linux/amd64,linux/arm64
66
+ build-args : |
67
+ APP_VERSION=${{ steps.set-variables.outputs.VERSION }}
68
+ push : true
69
+ tags : |
70
+ ${{ steps.set-variables.outputs.REPOSITORY }}/${{ steps.set-variables.outputs.IMAGE }}:latest
71
+ ${{ steps.set-variables.outputs.REPOSITORY }}/${{ steps.set-variables.outputs.IMAGE }}:${{ steps.set-variables.outputs.VERSION }}
72
+ labels : |
73
+ org.opencontainers.image.source=${{ github.repositoryUrl }}
74
+ org.opencontainers.image.created=${{ steps.set-variables.outputs.CREATED }}
75
+ org.opencontainers.image.revision=${{ steps.set-variables.outputs.VERSION }}
0 commit comments