From 9e412d15e08382346878dee45e111082f69f1332 Mon Sep 17 00:00:00 2001 From: Tahina Ramananandro Date: Sun, 9 Apr 2023 18:01:24 -0700 Subject: [PATCH] insert the commit SHA in Windows binary releases the Windows release task does not checkout the F* repository with the git command, but rather with the GitHub REST API, so we need to get the commit hash from outside --- .github/workflows/release.yml | 2 +- ocaml/fstar-lib/make_fstar_version.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65a498b63cd..6f4ffb1f581 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,6 +67,6 @@ jobs: - name: Package and release FStar shell: C:\cygwin64\bin\bash.exe --login '{0}' run: | - CI_THREADS=24 $GITHUB_WORKSPACE/.scripts/release.sh && echo "There is a CR at the end of this line" + FSTAR_COMMIT=$GITHUB_SHA CI_THREADS=24 $GITHUB_WORKSPACE/.scripts/release.sh && echo "There is a CR at the end of this line" env: GH_TOKEN: ${{ secrets.DZOMO_GITHUB_TOKEN }} diff --git a/ocaml/fstar-lib/make_fstar_version.sh b/ocaml/fstar-lib/make_fstar_version.sh index 54f92ed6e0b..2c8d10da529 100755 --- a/ocaml/fstar-lib/make_fstar_version.sh +++ b/ocaml/fstar-lib/make_fstar_version.sh @@ -14,7 +14,9 @@ else fi COMPILER="OCaml $(ocamlc -version)" # If a system does not have git, or we are not in a git repo, fallback with "unset" -COMMIT=$(git describe --match="" --always --abbrev=40 --dirty 2>/dev/null || echo unset) +if [[ -z "$FSTAR_COMMIT" ]] ; then + FSTAR_COMMIT=$(git describe --match="" --always --abbrev=40 --dirty 2>/dev/null || echo unset) +fi COMMITDATE=$(git log --pretty=format:%ci -n 1 2>/dev/null || echo unset) echo "let dummy () = ();;" @@ -23,4 +25,4 @@ echo "FStar_Options._platform := \"$PLATFORM\";;" echo "FStar_Options._compiler := \"$COMPILER\";;" # We deliberately use commitdate instead of date, so that rebuilds are no-ops echo "FStar_Options._date := \"$COMMITDATE\";;" -echo "FStar_Options._commit:= \"$COMMIT\";;" +echo "FStar_Options._commit:= \"$FSTAR_COMMIT\";;"