Skip to content

Commit 677b290

Browse files
committed
Add publication information to footer
1 parent 8ae27c6 commit 677b290

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

.github/workflows/static.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Deploy static content to Pages
33

44
on:
55
# Runs on pushes targeting the default branch
6-
# push:
7-
# branches: ["main"]
6+
# push:
7+
# branches: ["main"]
88

99
# Allows you to run this workflow manually from the Actions tab
1010
workflow_dispatch:
@@ -18,7 +18,7 @@ permissions:
1818
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
1919
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2020
concurrency:
21-
group: "pages"
21+
group: 'pages'
2222
cancel-in-progress: false
2323

2424
jobs:
@@ -31,6 +31,17 @@ jobs:
3131
steps:
3232
- name: Checkout
3333
uses: actions/checkout@v4
34+
- name: Add current deployment info to index.html
35+
run: |
36+
# Replace placeholders with commit information
37+
COMMIT_SHA=$(git rev-parse HEAD)
38+
COMMIT_DATE=$(git log -1 --format=%cd)
39+
COMMIT_URL="https://github.com/${{ github.repository }}/commit/${COMMIT_SHA}"
40+
PUBLISH_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
41+
sed -i "s|{{COMMIT_SHA}}|${COMMIT_SHA}|g" website/index.html
42+
sed -i "s|{{COMMIT_DATE}}|${COMMIT_DATE}|g" website/index.html
43+
sed -i "s|{{COMMIT_URL}}|${COMMIT_URL}|g" website/index.html
44+
sed -i "s|{{PUBLISH_DATE}}|${PUBLISH_DATE}|g" website/index.html
3445
- name: Setup Pages
3546
uses: actions/configure-pages@v4
3647
- name: Upload artifact

website/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,5 +228,14 @@ <h3>Color Apps</h3>
228228
</li>
229229
</ul>
230230
</section>
231+
<footer>
232+
<h2>Latest Publication Information</h2>
233+
<ul>
234+
<li>Commit SHA: <span>{{COMMIT_SHA}}</span></li>
235+
<li>Commit Date: <time datetime="{{COMMIT_DATE}}">{{COMMIT_DATE}}</time></li>
236+
<li>Commit URL: <a href="{{COMMIT_URL}}">View on GitHub</a></li>
237+
<li>Published Date: <time datetime="{{PUBLISH_DATE}}">{{PUBLISH_DATE}}</time></li>
238+
</ul>
239+
</footer>
231240
</body>
232241
</html>

0 commit comments

Comments
 (0)