Skip to content

Commit

Permalink
github actions: generate gitinfo with commit and build timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
allgood committed Jul 27, 2024
1 parent 4191f18 commit ecb3e7d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,19 @@ jobs:
cat <<EOT > backend/src/gitinfo.ts
export const GitInfo = {
commitHash: "$(git rev-parse --short HEAD)",
commitTimestamp: "$(date -u -d "$(git log -1 --format=%cI)" +'%Y-%m-%dT%H:%M:%SZ')",
branchName: "$(git rev-parse --abbrev-ref HEAD)",
tagName: "$(git describe --tags --abbrev=0 2>/dev/null || echo 'N/A')"
tagName: "$(git describe --tags --abbrev=0 2>/dev/null || echo 'N/A')",
buildTimestamp: "$(date -u +"%Y-%m-%dT%H:%M:%SZ)"
};
EOT
cat <<EOT > frontend/public/gitinfo.json
{
"commitHash": "$(git rev-parse --short HEAD)",
"commitTimestamp": "$(date -u -d "$(git log -1 --format=%cI)" +'%Y-%m-%dT%H:%M:%SZ')",
"branchName": "$(git rev-parse --abbrev-ref HEAD)",
"tagName": "$(git describe --tags --abbrev=0 2>/dev/null || echo 'N/A')"
"tagName": "$(git describe --tags --abbrev=0 2>/dev/null || echo 'N/A')",
"buildTimestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ)"
};
EOT
Expand Down

0 comments on commit ecb3e7d

Please sign in to comment.