@@ -10,12 +10,27 @@ jobs:
10
10
runs-on : ubuntu-20.04
11
11
steps :
12
12
13
- -
14
- name : Checkout
13
+ - name : Checkout
15
14
uses : actions/checkout@v2
16
15
17
- -
18
- name : Docker meta
16
+ - name : Generate build-args
17
+ id : build-args
18
+ run : |
19
+ # Declate vars for internal use
20
+ VERSION=$(git describe --abbrev=0 --tags)
21
+ GIT_HEAD_COMMIT=$(git rev-parse --short HEAD)
22
+ GIT_TAG_COMMIT=$(git rev-parse --short $VERSION)
23
+ GIT_MODIFIED_1=$(git diff $GIT_HEAD_COMMIT $GIT_TAG_COMMIT --quiet && echo "" || echo ".dev")
24
+ GIT_MODIFIED_2=$(git diff --quiet && echo "" || echo ".dirty")
25
+ # Export to GH_ENV
26
+ echo "GIT_LAST_TAG=$VERSION" >> $GITHUB_ENV
27
+ echo "GIT_HEAD_COMMIT=$GIT_HEAD_COMMIT" >> $GITHUB_ENV
28
+ echo "GIT_TAG_COMMIT=$GIT_TAG_COMMIT" >> $GITHUB_ENV
29
+ echo "GIT_MODIFIED=$(echo "$GIT_MODIFIED_1""$GIT_MODIFIED_2")" >> $GITHUB_ENV
30
+ echo "GIT_REPO=$(git config --get remote.origin.url)" >> $GITHUB_ENV
31
+ echo "BUILD_DATE=$(git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%dT%H:%M:%S)" >> $GITHUB_ENV
32
+
33
+ - name : Docker meta
19
34
id : meta
20
35
uses : docker/metadata-action@v3
21
36
with :
@@ -26,48 +41,49 @@ jobs:
26
41
flavor : |
27
42
latest=false
28
43
29
- -
30
- name : Set up QEMU
44
+ - name : Set up QEMU
31
45
id : qemu
32
46
uses : docker/setup-qemu-action@v1
33
47
with :
34
48
platforms : arm64,arm
35
49
36
- -
37
- name : Set up Docker Buildx
50
+ - name : Set up Docker Buildx
38
51
id : buildx
52
+ uses : docker/setup-buildx-action@v1
39
53
with :
40
54
install : true
41
- uses : docker/setup-buildx-action@v1
42
55
43
- -
44
- name : Inspect builder
56
+ - name : Inspect builder
45
57
run : |
46
58
echo "Name: ${{ steps.buildx.outputs.name }}"
47
59
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
48
60
echo "Status: ${{ steps.buildx.outputs.status }}"
49
61
echo "Flags: ${{ steps.buildx.outputs.flags }}"
50
62
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
51
63
52
- -
53
- name : Login to quay.io Container Registry
64
+ - name : Login to quay.io Container Registry
54
65
uses : docker/login-action@v1
55
66
with :
56
67
registry : quay.io
57
68
username : ${{ github.repository_owner }}+github
58
69
password : ${{ secrets.BOT_QUAY_IO }}
59
70
60
- -
61
- name : Build and push
71
+ - name : Build and push
62
72
id : build-release
63
73
uses : docker/build-push-action@v2
64
74
with :
65
75
file : Dockerfile
66
76
context : .
67
- platforms : linux/amd64,linux/arm64,linux/arm
77
+ platforms : linux/amd64
68
78
push : true
69
79
tags : ${{ steps.meta.outputs.tags }}
80
+ build-args : |
81
+ GIT_HEAD_COMMIT=${{ env.GIT_HEAD_COMMIT }}
82
+ GIT_TAG_COMMIT=${{ env.GIT_TAG_COMMIT }}
83
+ GIT_REPO=${{ env.GIT_REPO }}
84
+ GIT_LAST_TAG=${{ env.GIT_LAST_TAG }}
85
+ GIT_MODIFIED=${{ env.GIT_MODIFIED }}
86
+ BUILD_DATE=${{ env.BUILD_DATE }}
70
87
71
- -
72
- name : Image digest
88
+ - name : Image digest
73
89
run : echo ${{ steps.build-release.outputs.digest }}
0 commit comments