2022-07-14 09:45:04 -04:00
|
|
|
name: Determine pseudo version
|
|
|
|
description: "Determine go-like pseudo version to use as container image tag."
|
2022-08-03 10:01:36 -04:00
|
|
|
|
2022-07-14 09:45:04 -04:00
|
|
|
outputs:
|
2022-08-03 10:01:36 -04:00
|
|
|
semanticVersion:
|
|
|
|
description: "Semantic version based on the current HEAD"
|
|
|
|
value: ${{ steps.pseudo-version.outputs.semanticVersion }}
|
2023-03-14 09:53:33 -04:00
|
|
|
version:
|
|
|
|
description: "Version based on branch name"
|
|
|
|
value: ${{ steps.pseudo-version.outputs.version }}
|
2022-08-03 10:01:36 -04:00
|
|
|
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 }}
|
|
|
|
|
2022-09-14 09:14:26 -04:00
|
|
|
# Linux runner only (homedir trick does not work on macOS, required for private runner)
|
2022-07-14 09:45:04 -04:00
|
|
|
runs:
|
2022-08-19 09:55:44 -04:00
|
|
|
using: "composite"
|
2022-07-14 09:45:04 -04:00
|
|
|
steps:
|
2023-03-14 09:53:33 -04:00
|
|
|
- name: get version
|
2022-08-19 09:55:44 -04:00
|
|
|
id: pseudo-version
|
2023-01-18 04:15:58 -05:00
|
|
|
shell: bash
|
|
|
|
working-directory: hack/pseudo-version
|
2022-08-19 09:55:44 -04:00
|
|
|
run: |
|
|
|
|
homedir="$(getent passwd $(id -u) | cut -d ":" -f 6)"
|
|
|
|
export GOCACHE=${homedir}/.cache/go-build
|
|
|
|
export GOPATH=${homedir}/go
|
|
|
|
export GOMODCACHE=${homedir}/.cache/go-mod
|
2023-03-14 09:53:33 -04:00
|
|
|
|
|
|
|
version=$(go run .)
|
2022-08-19 09:55:44 -04:00
|
|
|
semanticVersion=$(go run . -semantic-version)
|
|
|
|
timestamp=$(go run . -print-timestamp)
|
|
|
|
branchName=$(go run . -print-branch)
|
2023-03-14 09:53:33 -04:00
|
|
|
|
|
|
|
echo "version=${version}" >> $GITHUB_OUTPUT
|
2022-10-12 05:43:32 -04:00
|
|
|
echo "semanticVersion=${semanticVersion}" >> $GITHUB_OUTPUT
|
|
|
|
echo "timestamp=${timestamp}" >> $GITHUB_OUTPUT
|
|
|
|
echo "branchName=${branchName}" >> $GITHUB_OUTPUT
|