constellation/.github/actions/pseudo_version/action.yml

56 lines
2.0 KiB
YAML

name: Determine pseudo version
description: "Determine go-like pseudo version to use as container image tag."
outputs:
pseudoVersion:
description: "Pseudo version based on the current HEAD"
value: ${{ steps.pseudo-version.outputs.pseudoVersion }}
semanticVersion:
description: "Semantic version based on the current HEAD"
value: ${{ steps.pseudo-version.outputs.semanticVersion }}
releaseVersion:
description: "Release version based on branch name"
value: ${{ steps.pseudo-version.outputs.releaseVersion }}
timestamp:
description: "Commit timestamp based on the current HEAD"
value: ${{ steps.pseudo-version.outputs.timestamp }}
branchName:
description: "Branch name"
value: ${{ steps.pseudo-version.outputs.branchName }}
runs:
using: "composite"
steps:
- name: Install Go
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a
with:
go-version: "1.18"
- name: get pseudo version
id: pseudo-version
run: |
set -e
set -o pipefail
if $(git rev-parse --is-shallow-repository); then
git fetch --prune --unshallow --tags -v
else
git fetch --tags -v
fi
homedir="$(getent passwd $(id -u) | cut -d ":" -f 6)"
export GOCACHE=${homedir}/.cache/go-build
export GOPATH=${homedir}/go
export GOPRIVATE=github.com/edgelesssys
export GOMODCACHE=${homedir}/.cache/go-mod
pseudoVersion=$(go run .)
semanticVersion=$(go run . -semantic-version)
timestamp=$(go run . -print-timestamp)
branchName=$(go run . -print-branch)
releaseVersion=$(go run . -print-release-branch)
echo "::set-output name=pseudoVersion::${pseudoVersion}"
echo "::set-output name=semanticVersion::${semanticVersion}"
echo "::set-output name=timestamp::${timestamp}"
echo "::set-output name=branchName::${branchName}"
echo "::set-output name=releaseVersion::${releaseVersion}"
working-directory: hack/pseudo-version
shell: bash {0}