File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments