From 59ea86d7c0512e618f60803c25861c530baf09a2 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Wed, 1 Nov 2023 09:00:27 -0700 Subject: [PATCH] refactor: move 'git archive' configuration to .gitattributes (#641) Makes it match bazelbuild/rules_proto#189 --- .gitattributes | 11 +++++++++++ .github/workflows/release_prep.sh | 14 ++++---------- tools/version.bzl | 2 +- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.gitattributes b/.gitattributes index fb496ed..dfe2780 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,12 @@ +# In code review, collapse generated files docs/*.md linguist-generated=true + +################################# +# Configuration for 'git archive' +# see https://git-scm.com/docs/git-archive#ATTRIBUTES + +# Omit folders that users don't need, making the distribution artifact smaller +lib/tests export-ignore + +# Substitution for the _VERSION_PRIVATE placeholder +tools/version.bzl export-subst diff --git a/.github/workflows/release_prep.sh b/.github/workflows/release_prep.sh index c24d21d..4215028 100755 --- a/.github/workflows/release_prep.sh +++ b/.github/workflows/release_prep.sh @@ -2,22 +2,16 @@ set -o errexit -o nounset -o pipefail -# Configuration for 'git archive' -# see https://git-scm.com/docs/git-archive/2.40.0#ATTRIBUTES -cat >.git/info/attributes < $ARCHIVE SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}') diff --git a/tools/version.bzl b/tools/version.bzl index 6967419..86f9ae4 100644 --- a/tools/version.bzl +++ b/tools/version.bzl @@ -1,7 +1,7 @@ "version information. replaced with stamped info with each release" # This is automagically replace by git during git archive using `git export-subst` -# See https://git-scm.com/docs/git-archive/2.29.0#Documentation/git-archive.txt-export-subst +# See https://git-scm.com/docs/git-archive#Documentation/git-archive.txt-export-subst _VERSION_PRIVATE = "$Format:%(describe:tags=true)$" VERSION = "0.0.0" if _VERSION_PRIVATE.startswith("$Format") else _VERSION_PRIVATE.replace("v", "", 1)