Skip to content

Commit

Permalink
Merge pull request #573 from gmlueck/gmlueck/ci-commit
Browse files Browse the repository at this point in the history
Correct commit id when building from CI
  • Loading branch information
gmlueck committed Jun 28, 2024
2 parents f0b79d1 + 6b8dffa commit 1b4d5b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Build spec targets
run: |
cd adoc
make OUTDIR=/tmp/out QUIET= html pdf
make OUTDIR=/tmp/out QUIET= COMMIT_SHA=$GITHUB_SHA html pdf
- name: Verify reflow conformance
run: |
./adoc/scripts/verify_reflow_conformance.sh
Expand Down
24 changes: 8 additions & 16 deletions adoc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,14 @@ NOTEOPTS = --attribute showtodos
# Spell out ISO 8601 format as not all date commands support --rfc-3339
SPECDATE = $(shell echo `date -u "+%Y-%m-%d %TZ"`)

# Generate Asciidoc attributes for spec remark
# Could use `git log -1 --format="%cd"` to get branch commit date
# This used to be a dependency in the spec html/pdf targets,
# but that's likely to lead to merge conflicts. Just regenerate
# when pushing a new spec for review to the sandbox.
# The dependency on HEAD is per the suggestion in
# http://neugierig.org/software/blog/2014/11/binary-revisions.html
# Get back something clearer from the old LaTeX-based specification by
# name the exact annotated tag. If not, list a path to the closest tag.
SPECREMARK = from git $(shell \
echo `git describe --exact-match 2> /dev/null \
|| ( git describe 2> /dev/null; echo "on branch:" ; \
git symbolic-ref --short HEAD 2> /dev/null \
|| echo Git branch not available )`) \
commit: $(shell echo `git log -1 --format="%H" 2> /dev/null \
|| echo Git commit not available`)
# Deterine the commit ID that is printed at the top of the spec.
# In some CI systems, the build may happen outside of a git repo, so
# "git log" may not be available. These CI systems set the commit id via
# "make COMMIT_SHA=...", so the build process doesn't need the "git log"
# command.
SPECREMARK = commit $(COMMIT_SHA)
COMMIT_SHA = $(shell echo `git log -1 --format="%H" 2> /dev/null \
|| echo "(not available)"`)
# Some of the attributes used in building all spec documents:
# chapters - absolute path to chapter sources
Expand Down

0 comments on commit 1b4d5b6

Please sign in to comment.