2021-11-14 03:53:13 +01:00
|
|
|
# Get the version.
|
|
|
|
githash=`git rev-parse --short HEAD`
|
2023-06-29 22:58:24 +02:00
|
|
|
branch=`git rev-parse --abbrev-ref HEAD`
|
2021-11-14 03:53:13 +01:00
|
|
|
buildstamp=`date -u '+%Y-%m-%d_%H:%M:%S'`
|
2023-06-29 23:20:46 +02:00
|
|
|
commits=`git rev-list --count $branch`
|
2021-11-14 03:53:13 +01:00
|
|
|
# Write out the package.
|
|
|
|
cat << EOF > version.go
|
|
|
|
// Code generated by version.sh (@generated) DO NOT EDIT.
|
|
|
|
package main
|
|
|
|
var githash = "$githash"
|
2023-06-29 22:58:24 +02:00
|
|
|
var branch = "$branch"
|
2021-11-14 03:53:13 +01:00
|
|
|
var buildstamp = "$buildstamp"
|
|
|
|
var commits = "$commits"
|
|
|
|
var version = "$githash-b$commits - $buildstamp"
|
|
|
|
EOF
|