@@ -8,27 +8,34 @@ echo "Building $IMAGE"
8
8
DEFAULT_GOLANG_VERSION=" 1.21"
9
9
DEFAULT_CHISEL_VERSION=" v0.10.0"
10
10
11
- RELEASE=$( ./images/${IMAGE} /latest.sh)
11
+ REPOSITORY=$( jq -r ' .repository' ./images/${IMAGE} /metadata.json)
12
+ RELEASE_METADATA=$( curl -s " https://api.github.com/repos/${REPOSITORY} /releases/latest" )
13
+ SOURCE_DATE_EPOCH=$( date +%s -d $( echo ${RELEASE_METADATA} | jq -r ' .created_at' ) )
14
+ RELEASE=$( echo ${RELEASE_METADATA} | jq -r ' .tag_name' )
12
15
VERSION=${RELEASE%% _* }
13
16
VERSION=${VERSION# release-}
14
17
VERSION=${VERSION# v}
15
18
19
+ echo " Version $VERSION "
16
20
if [[ -z $VERSION ]]; then
17
21
echo " Failed to retrieve latest version for $IMAGE "
18
22
else
19
23
docker buildx build \
20
- --push \
21
24
--platform linux/amd64,linux/arm64 \
25
+ --provenance=false \
22
26
--tag ghcr.io/${GITHUB_REPOSITORY_OWNER,,} /${IMAGE} :${VERSION} \
23
27
--tag ghcr.io/${GITHUB_REPOSITORY_OWNER,,} /${IMAGE} :latest \
24
28
--build-arg RELEASE=${RELEASE} \
25
29
--build-arg VERSION=${VERSION} \
26
30
--build-arg GOLANG_VERSION=${DEFAULT_GOLANG_VERSION} \
27
31
--build-arg CHISEL_VERSION=${DEFAULT_CHISEL_VERSION} \
32
+ --build-arg SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
28
33
--label " org.opencontainers.image.authors=${GITHUB_REPOSITORY_OWNER} " \
29
34
--label " org.opencontainers.image.source=${GITHUB_SERVER_URL} /${GITHUB_REPOSITORY} " \
30
35
--label " org.opencontainers.image.version=${VERSION} " \
31
36
--label " org.opencontainers.image.vendor=${GITHUB_REPOSITORY_OWNER} " \
32
37
--label " org.opencontainers.image.title=${IMAGE} " \
38
+ --output type=registry,name=ghcr.io/${GITHUB_REPOSITORY_OWNER,,} /${IMAGE} :${VERSION} ,rewrite-timestamp=true \
39
+ --output type=registry,name=ghcr.io/${GITHUB_REPOSITORY_OWNER,,} /${IMAGE} :latest,rewrite-timestamp=true \
33
40
- < images/${IMAGE} /Dockerfile
34
41
fi
0 commit comments