Skip to content

Commit

Permalink
feat: stamp the version into the artifact (#93)
Browse files Browse the repository at this point in the history
This avoids the need for Publish To BCR to create patch files like bazel-contrib/publish-to-bcr#28
and reduces the clutter of module_dot_bazel.patch files in BCR
  • Loading branch information
alexeagle authored Sep 5, 2023
1 parent 8a3383a commit 7d0f586
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +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 <<EOF
# Substitution for the VERSION placeholder at the top of this file
MODULE.bazel export-subst
# Omit folders that users don't need, making the distribution artifact smaller
examples export-ignore
EOF

# Set by GH actions, see
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
TAG=${GITHUB_REF_NAME}
Expand Down
5 changes: 4 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
"Bazel dependencies"

# replaced by export-subst during 'git archive'
VERSION = "$Format:%(describe:tags=true)$"

module(
name = "com_myorg_rules_mylang",
version = "0.0.0",
version = "0.0.0" if VERSION.startswith("$Format") else VERSION,
compatibility_level = 1,
)

Expand Down

0 comments on commit 7d0f586

Please sign in to comment.