Skip to content

Commit

Permalink
Publish date and commit hashes
Browse files Browse the repository at this point in the history
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
  • Loading branch information
bact committed Aug 7, 2024
1 parent 3666225 commit fef9c30
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/workflows/publish_v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,26 @@ jobs:
- name: Deploy - Sync gh-pages
working-directory: spdx-spec
run: git checkout gh-pages && git pull && git checkout test-publish-301-on-bact
- name: Get current date, time, and commit hashes
run: |
PUBLICATION_DATETIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "Current date and time: $PUBLICATION_DATETIME"
sed -i "s/__PUBLICATION_DATETIME_/ publication_datetime: '$DATETIME'/" spdx-spec/mkdocs.yml
cd spec-parser
COMMIT_HASH_SPEC=$(git rev-parse HEAD)
echo "spdx-spec commit hash: $COMMIT_HASH_SPEC"
cd ..
sed -i "s/__COMMIT_HASH_SPEC__/ commit_hash_spec: '$COMMIT_HASH_SPEC'/" spdx-spec/mkdocs.yml
cd spdx-3-model
COMMIT_HASH_MODEL=$(git rev-parse HEAD)
echo "spdx-3-model commit hash: $COMMIT_HASH_MODEL"
cd ..
sed -i "s/__COMMIT_HASH_MODEL__/ commit_hash_model: '$COMMIT_HASH_MODEL'/" spdx-spec/mkdocs.yml
cd spec-parser
COMMIT_HASH_PARSER=$(git rev-parse HEAD)
echo "spec-parser commit hash: $COMMIT_HASH_PARSER"
cd ..
sed -i "s/__COMMIT_HASH_PARSER__/ commit_hash_spec: '$COMMIT_HASH_PARSER'/" spdx-spec/mkdocs.yml
- name: Deploy - Deploy the site, set aliases, and set default version
working-directory: spdx-spec
run: |
Expand Down
8 changes: 7 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ copyright: -- DRAFT -- SPDX v3.0.1 Copyright © 2010-2024 Linux Foundation and i
use_directory_urls: true
theme:
name: readthedocs
custom_dir: overrides # directory containing custom templates, like footer
sticky_navigation: true
plugins:
- search
Expand Down Expand Up @@ -42,7 +43,7 @@ nav:
- 'Terms and definitions': terms-and-definitions.md
- 'Model and serializations': serializations.md
- 'Bibliography': bibliography.md
- model # __MODEL_PLACEHOLDER__, to be replaced by content from mkdocs-files.yml
- model # __MODEL_PLACEHOLDER__ ; Do not edit, to be replaced by content from mkdocs-files.yml
- annexes:
- 'Differences from previous editions': annexes/diffs-from-previous-editions.md
- 'Getting started with SPDX 3': annexes/getting-started.md
Expand All @@ -61,3 +62,8 @@ nav:
draft_docs: | # for preview with `mkdocs serve`, but excluded from `mkdocs build`
ISO_foreword.md
conformance.md
extra:
publication_datetime: '2024-08-07 19:00' # __PUBLICATION_DATETIME__ ; Do not edit
commit_hash_spec: '000000' # __COMMIT_HASH_SPEC__ ; Do not edit
commit_hash_model: '000000' # __COMMIT_HASH_MODEL__ ; Do not edit
commit_hash_parser: '00000' # __COMMIT_HASH_PARSER__ ; Do not edit
10 changes: 10 additions & 0 deletions overrides/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% extends "base.html" %}

{% block footer %}
{{ super() }}
<div class="footer">
<div>Published on: {{ config.extra.publication_datetime }}</div>
<div>Generated by: spec-parser ({{ config.extra.commit_hash_parser }})</div>
<div>Source files: spdx-spec ({{ config.extra.commit_hash_spec }}) and spdx-3-model ({{ config.extra.commit_hash_model }})</div>
</div>
{% endblock %}

0 comments on commit fef9c30

Please sign in to comment.