Skip to content

Commit 07d039d

Browse files
committed
chore: pass the suffix to build-os-package
This is required because for some reason ggshield ".git" dir is not visible inside the Rocky Linux container.
1 parent ff7e6c4 commit 07d039d

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

.github/workflows/build_release_assets.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ jobs:
219219
if [ "${{ inputs.release_mode }}" = "true" ] ; then
220220
args="--sign"
221221
else
222-
#args="--git-version"
223-
args=""
222+
args="--suffix +${GITHUB_SHA:0:8}"
224223
fi
225224
pipenv run bash -c scripts/build-os-packages/build-os-packages $args
226225

scripts/build-os-packages/build-os-packages

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ REQUIREMENTS="pyinstaller"
1515
# Whether we want a signed binary or not
1616
DO_SIGN=0
1717

18-
# Where to find the version:
19-
# - 0: read it from ggshield/__init__.py
20-
# - 1: generate it using `git describe`
21-
USE_GIT_VERSION=0
18+
VERSION_SUFFIX=""
2219

2320
# Colors
2421
C_RED="\e[31;1m"
@@ -62,7 +59,7 @@ Default steps are: $DEFAULT_STEPS
6259
Options:
6360
-h, --help Display this usage message and exit.
6461
--sign Sign the binary, on supported OSes.
65-
--git-version Append "+COMMIT_SHA" to the version number.
62+
--suffix SUFFIX Append "SUFFIX" to the version number.
6663
6764
For more details, see doc/dev/os-packages.md.
6865
EOF
@@ -72,10 +69,8 @@ EOF
7269

7370
read_version() {
7471
VERSION=$(grep -o "[0-9]*\.[0-9]*\.[0-9]*" "$ROOT_DIR/ggshield/__init__.py")
75-
if [ "$USE_GIT_VERSION" -eq 1 ] ; then
76-
local commit_sha
77-
commit_sha=$(git rev-parse --short HEAD)
78-
VERSION="$VERSION+$commit_sha"
72+
if [ -n "$VERSION_SUFFIX" ] ; then
73+
VERSION="${VERSION}${VERSION_SUFFIX}"
7974
fi
8075
info "VERSION=$VERSION"
8176
}
@@ -343,8 +338,9 @@ while [ $# -gt 0 ] ; do
343338
--sign)
344339
DO_SIGN=1
345340
;;
346-
--git-version)
347-
USE_GIT_VERSION=1
341+
--suffix)
342+
VERSION_SUFFIX="$2"
343+
shift
348344
;;
349345
-*)
350346
usage "Unknown option '$1'"

0 commit comments

Comments
 (0)