Skip to content

Commit d077269

Browse files
committed
add data for the image version
1 parent 33c7747 commit d077269

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.github/workflows/main.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ jobs:
7575
- name: Fetch tags
7676
run: git fetch --tags --force
7777

78+
- name: Generate version file
79+
run: |
80+
81+
# Build the final JSON object
82+
json_string=$(jq -n \
83+
--arg date "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
84+
--arg commit_sha "${GITHUB_SHA}" \
85+
--arg commit_tag "$(git describe --tags --abbrev=0 2>/dev/null || echo "untagged")" \
86+
--arg image_name "${{ matrix.name }}" \
87+
--arg image_source "${{ matrix.base_image }}" \
88+
'{build_date: $date, commit_sha: $commit_sha, commit_tag: $commit_tag, image_name: $image_name, image_source: $image_source}')
89+
90+
echo "$json_string"
91+
92+
echo "$json_string" > image-version.json
93+
7894
- name: Install dependencies and build image
7995
uses: photonvision/photon-image-runner@HEAD
8096
id: install_deps

install_common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ echo "Banner \/etc\/issue.net" > /etc/ssh/sshd_config.d/10_PhotonVisionBanner.co
3333

3434
# Add photon version file
3535
mkdir -p /opt/photonvision/
36-
echo "${GITHUB_REF_NAME};${image_name}" > /opt/photonvision/image-version
36+
cp -f ./photon_version.json /opt/photonvision/photon_version.json

0 commit comments

Comments
 (0)