Some checks failed
Research feed publisher tests / test (push) Failing after 3s
Release / Pre-flight checks (push) Failing after 0s
Release / Research Edition — patch and packaging smoke tests (push) Has been skipped
Release / Build Qt artifacts (false, 22, ubuntu-22.04, 3.9, ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) }}, false, false) (push) Has been skipped
Release / Build Qt artifacts (false, 22, ubuntu-22.04, 3.9, false, false, false) (push) Has been skipped
Release / Build Qt artifacts (manylinux_2_28 — glibc 2.28 ABI floor) (22, 3.9) (push) Has been skipped
Release / Generate release notes (push) Has been skipped
Release / Create dev release tag (push) Has been skipped
CodeQL / Analyze (javascript) (push) Failing after 1s
CodeQL / Analyze (python) (push) Failing after 1s
Release / Build Qt artifacts (false, 22, windows-latest, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, macos-15-intel, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, macos-latest, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, ubuntu-24.04, 3.9, ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) }}, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, ubuntu-24.04, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, ubuntu-24.04-arm, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, windows-latest, 3.9, false, false, false) (push) Has been cancelled
Release / Build Qt artifacts (false, 22, macos-15-intel, 3.9, false, false, false) (push) Has been cancelled
Release / Build Qt artifacts (false, 22, macos-latest, 3.9, false, false, false) (push) Has been cancelled
Release / Publish draft release (push) Has been cancelled
94 lines
2.5 KiB
Bash
Executable File
Vendored
94 lines
2.5 KiB
Bash
Executable File
Vendored
#!/bin/bash
|
|
set -e
|
|
|
|
SCRIPT_NAME="$(basename "$0")"
|
|
STRIP_V=false
|
|
|
|
show_usage() {
|
|
cat << EOF
|
|
Usage: $SCRIPT_NAME [OPTIONS]
|
|
|
|
Get the version of ActivityWatch from git tags or CI environment variables.
|
|
|
|
Options:
|
|
--strip-v, --no-v Remove the 'v' prefix from the version (if present)
|
|
--help, -h Show this help message
|
|
|
|
Environment Variables (used in CI, checked in priority order):
|
|
GITHUB_REF_NAME GitHub Actions tag/ref (e.g., "v0.14.0")
|
|
TRAVIS_TAG Travis CI tag
|
|
APPVEYOR_REPO_TAG_NAME AppVeyor CI tag
|
|
|
|
Version Format:
|
|
- Release tag: v0.14.0
|
|
- Dev version: v0.14.0.dev-abc1234
|
|
- Beta/RC: v0.14.0b1, v0.14.0rc1
|
|
|
|
Examples:
|
|
$SCRIPT_NAME # v0.14.0 or v0.14.0.dev-abc1234
|
|
$SCRIPT_NAME --strip-v # 0.14.0 or 0.14.0.dev-abc1234
|
|
EOF
|
|
}
|
|
|
|
parse_args() {
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--strip-v|--no-v)
|
|
STRIP_V=true
|
|
shift
|
|
;;
|
|
--help|-h)
|
|
show_usage
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "ERROR: Unknown argument: $1" >&2
|
|
show_usage >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
get_version_internal() {
|
|
local _version=""
|
|
|
|
if [[ -n "$GITHUB_REF" && "$GITHUB_REF" == refs/tags/v* ]]; then
|
|
_version="$GITHUB_REF_NAME"
|
|
elif [[ -n "$TRAVIS_TAG" ]]; then
|
|
_version="$TRAVIS_TAG"
|
|
elif [[ -n "$APPVEYOR_REPO_TAG_NAME" ]]; then
|
|
_version="$APPVEYOR_REPO_TAG_NAME"
|
|
else
|
|
_version="$(git describe --tags --abbrev=0 --exact-match 2>/dev/null || true)"
|
|
if [[ -z "$_version" ]]; then
|
|
local _latest_tag
|
|
# Exclude research-edition tags so dev versions off master don't
|
|
# inherit a "-research" base (e.g. v0.14.0b4-research.dev-abc1234).
|
|
# Exact-match above intentionally keeps them: building *on* a
|
|
# research tag must report the research version.
|
|
_latest_tag="$(git describe --tags --abbrev=0 --exclude '*-research' 2>/dev/null || echo "v0.0.0")"
|
|
local _commit_hash
|
|
_commit_hash="$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")"
|
|
_version="${_latest_tag}.dev-${_commit_hash}"
|
|
fi
|
|
fi
|
|
|
|
echo "$_version"
|
|
}
|
|
|
|
main() {
|
|
parse_args "$@"
|
|
|
|
local version
|
|
version="$(get_version_internal)"
|
|
|
|
if $STRIP_V; then
|
|
version="$(echo "$version" | sed -e 's/^v//')"
|
|
fi
|
|
|
|
echo "$version"
|
|
}
|
|
|
|
main "$@"
|