8
8
required : true
9
9
description : ' Release type (latest, beta, edge, dev, etc)'
10
10
default : ' edge'
11
- version :
12
- type : string
13
- required : false
14
- description : ' Version to build (e.g. 1.0.0)'
15
- default : " ${{ github.ref_name }}"
16
- ref_type :
17
- type : string
18
- required : false
19
- description : ' Trigger type (tag or branch)'
20
- default : " ${{ github.ref_type }}"
21
- ref :
22
- type : string
23
- required : false
24
- description : ' Ref to build (e.g. v1.0.0)'
25
- default : ' '
11
+
26
12
jobs :
27
13
28
14
build-and-push :
29
15
runs-on : ubuntu-24.04
30
16
steps :
31
17
- name : Check out code.
32
18
uses : actions/checkout@v4
33
- with :
34
- ref : ${{ inputs.ref }}
35
19
36
20
- name : Login to DockerHub
37
21
uses : docker/login-action@v3
55
39
- name : Set REPOSITORY_BUILD_VERSION
56
40
id : set_version
57
41
run : |
58
- if [ "${{ inputs .ref_type }}" == "tag" ]; then
42
+ if [ "${{ github .ref_type }}" == "tag" ]; then
59
43
echo "🚀 Setting REPOSITORY_BUILD_VERSION to Tag"
60
- echo "REPOSITORY_BUILD_VERSION=${{ inputs.version }}-${{ github.run_id }}" >> $GITHUB_ENV
44
+ echo "REPOSITORY_BUILD_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
61
45
else
62
46
echo "👨🔬 Setting REPOSITORY_BUILD_VERSION to GIT Short SHA and GitHub Run ID"
63
47
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
@@ -66,41 +50,18 @@ jobs:
66
50
67
51
- name : " 📦 Assemble the Docker Tags"
68
52
run : |
69
- if [ "${{ inputs .ref_type }}" == "tag" ]; then
53
+ if [ "${{ github .ref_type }}" == "tag" ]; then
70
54
bash build.sh \
71
55
--release-type ${{ inputs.release_type }} \
72
- --version ${{ inputs.version }} \
56
+ --version ${{ github.ref_name }} \
73
57
--print-tags-only
74
58
else
75
59
bash build.sh \
76
60
--release-type ${{ inputs.release_type }} \
77
61
--print-tags-only
78
62
fi
79
63
80
- - name : Build and export to Docker
81
- uses : docker/build-push-action@v6
82
- with :
83
- file : src/Dockerfile
84
- cache-from : type=gha,mode=max
85
- cache-to : type=gha,mode=max
86
- platforms : linux/amd64 # Only build amd64 for scanning
87
- pull : true
88
- push : false
89
- load : true # Load into Docker's local image store
90
- tags : ${{ env.DOCKER_TAGS }}
91
-
92
- - name : Run Trivy vulnerability scanner
93
- uses : aquasecurity/trivy-action@0.29.0
94
- with :
95
- image-ref : ${{ env.DOCKER_TAGS }}
96
- format : ' table'
97
- exit-code : 1
98
- ignore-unfixed : true
99
- severity : ' CRITICAL,HIGH'
100
- hide-progress : true
101
-
102
- - name : Build and push all platforms
103
- if : success()
64
+ - name : Build and push
104
65
uses : docker/build-push-action@v6
105
66
with :
106
67
file : src/Dockerfile
0 commit comments