Skip to content

Commit 1ab2093

Browse files
committed
feat: add build-info.json generation to release workflow for enhanced build metadata
1 parent b0c2d34 commit 1ab2093

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/release-frontend.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,33 @@ jobs:
3838
with:
3939
node-version: '22.x'
4040

41+
- name: Generate build-info.json
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
run: |
45+
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-8)
46+
BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
47+
BRANCH="${{ github.ref_name }}"
48+
FULL_SHA="${{ github.sha }}"
49+
TAG="null"
50+
51+
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
52+
TAG="${{ github.ref_name }}"
53+
fi
54+
55+
COMMIT_URL="https://github.com/${{ github.repository }}/commit/$SHORT_SHA"
56+
57+
cat <<EOF > build.info.json
58+
{
59+
"buildTime": "$BUILD_TIME",
60+
"commitFull": "$FULL_SHA",
61+
"commit": "$SHORT_SHA",
62+
"tag": $( [ "$TAG" = "null" ] && echo null || echo "\"$TAG\"" ),
63+
"branch": "$BRANCH",
64+
"commitUrl": "$COMMIT_URL"
65+
}
66+
EOF
67+
4168
- name: Install dependencies and build
4269
run: |
4370
npm install

0 commit comments

Comments
 (0)