mirror of https://github.com/k3s-io/k3s
Update versioning for no .git or go
parent
3410986357
commit
456962b2b8
|
@ -1,20 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
TREE_STATE=clean
|
||||
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
|
||||
DIRTY="-dirty"
|
||||
TREE_STATE=dirty
|
||||
fi
|
||||
|
||||
COMMIT=$(git log -n3 --pretty=format:"%H %ae" | grep -v ' drone@localhost$' | cut -f1 -d\ | head -1)
|
||||
if [ -z "${COMMIT}" ]; then
|
||||
COMMIT=$(git rev-parse HEAD)
|
||||
fi
|
||||
|
||||
GIT_TAG=${DRONE_TAG:-$(git tag -l --contains HEAD | head -n 1)}
|
||||
|
||||
ARCH=$(go env GOARCH)
|
||||
ARCH=${ARCH:-$(go env GOARCH)}
|
||||
SUFFIX="-${ARCH}"
|
||||
GIT_TAG=$DRONE_TAG
|
||||
TREE_STATE=clean
|
||||
COMMIT=unknown
|
||||
|
||||
if [ -d .git ]; then
|
||||
if [ -z "$GIT_TAG" ]; then
|
||||
GIT_TAG=$(git tag -l --contains HEAD | head -n 1)
|
||||
fi
|
||||
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
|
||||
DIRTY="-dirty"
|
||||
TREE_STATE=dirty
|
||||
fi
|
||||
|
||||
COMMIT=$(git log -n3 --pretty=format:"%H %ae" | grep -v ' drone@localhost$' | cut -f1 -d\ | head -1)
|
||||
if [ -z "${COMMIT}" ]; then
|
||||
COMMIT=$(git rev-parse HEAD || true)
|
||||
fi
|
||||
fi
|
||||
|
||||
VERSION_CONTAINERD=$(grep github.com/containerd/containerd go.mod | head -n1 | awk '{print $4}')
|
||||
if [ -z "$VERSION_CONTAINERD" ]; then
|
||||
|
|
Loading…
Reference in New Issue