mirror of
https://github.com/AnalogJ/scrutiny.git
synced 2026-07-31 15:47:27 -04:00
The release workflow is a workflow_dispatch on master, so GITHUB_REF_NAME is "master" and git.version.sh writes "master#<sha>" into versions.ts. Every scrutiny-web-frontend.tar.gz attached to a release therefore shows the branch instead of the version, which is what the web UI displays. The tag-push path used for the docker images was already correct, so this only affects binary/manual installs. git.version.sh now takes an explicit SCRUTINY_VERSION, and the release workflow passes the version that the bump step just wrote to version.go, failing the job if it cannot read it. Closes #998
35 lines
1.2 KiB
Bash
Executable File
35 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
if [[ -n "${SCRUTINY_VERSION}" ]]; then
|
|
# The release workflow runs from master via workflow_dispatch, so there is no tag in
|
|
# GITHUB_REF_NAME to pick up. It passes the version it just bumped instead.
|
|
echo "using the version supplied in SCRUTINY_VERSION"
|
|
VERSION_INFO="${SCRUTINY_VERSION}"
|
|
elif [[ -z "${CI}" ]]; then
|
|
echo "running locally (not in Github Actions). generating version file from git client"
|
|
GIT_TAG=`git describe --tags`
|
|
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
|
|
|
|
if [[ "$GIT_BRANCH" == "master" ]]; then
|
|
VERSION_INFO="${GIT_TAG}"
|
|
else
|
|
VERSION_INFO="${GIT_BRANCH}#${GIT_TAG}"
|
|
fi
|
|
else
|
|
echo "running in Github Actions, generating version file from environmental variables"
|
|
# https://docs.github.com/en/actions/learn-github-actions/environment-variables
|
|
VERSION_INFO="${GITHUB_REF_NAME}"
|
|
|
|
if [[ "$GITHUB_REF_TYPE" == "branch" ]]; then
|
|
VERSION_INFO="${VERSION_INFO}#${GITHUB_SHA::7}"
|
|
fi
|
|
fi
|
|
|
|
echo "writing version file (version: ${VERSION_INFO})"
|
|
cat <<EOT > src/environments/versions.ts
|
|
// this file is automatically generated by git.version.ts script
|
|
export const versionInfo = {
|
|
version: '${VERSION_INFO}',
|
|
};
|
|
EOT
|