[BACK]Return to git-extra-version CVS log [TXT][DIR] Up to [contributed] / brogue-ce / tools

Annotation of brogue-ce/tools/git-extra-version, Revision 1.1

1.1     ! rubenllo    1: #!/bin/bash
        !             2: set -euo pipefail
        !             3:
        !             4: # Emit extra version string (if any) to append to BROGUE_VERSION_STRING
        !             5:
        !             6: # Release builds should write nothing to stdout.  Development builds
        !             7: # (everything else) should write something, but what depends on the information
        !             8: # available.
        !             9:
        !            10: # If we're in CI and the ref is the gha-build branch, assume we are a release
        !            11: if [[ ${GITHUB_ACTIONS:-false} == true ]] && [[ $GITHUB_REF =~ ^refs/heads/gha-build ]]
        !            12: then
        !            13:     exit 0
        !            14: fi
        !            15:
        !            16: # Otherwise we must be a development build
        !            17:
        !            18: if [[ ${GITHUB_ACTIONS:-false} == true ]]
        !            19: then
        !            20:     # If we're in CI, use what they hand us
        !            21:     # If it's a branch, strip refs/heads.  Highlight tags by keeping the prefix
        !            22:     EXTRA_VERSION="-dev.${GITHUB_SHA:0:7}.${GITHUB_REF##refs/heads/}"
        !            23: elif { which git && git rev-parse --show-toplevel; } >/dev/null 2>&1
        !            24: then
        !            25:     # Otherwise inspect git if it and a repo are available
        !            26:     EXTRA_VERSION="-dev.$(git log -1 --format='%h').$(git rev-parse --abbrev-ref HEAD)"
        !            27: else
        !            28:     # Finally, if nothing else just call it "development"
        !            29:     EXTRA_VERSION=-dev
        !            30: fi
        !            31:
        !            32: # No matter what, limit the extra version to 64 characters
        !            33: echo "${EXTRA_VERSION:0:64}"

CVSweb