-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0172027
commit 2b26cd4
Showing
6 changed files
with
64 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,12 @@ jobs: | |
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | ||
- name: Get short commit hash | ||
run: echo "TAG=sha-${GITHUB_SHA::7}" >>${GITHUB_ENV} | ||
- name: Get git info | ||
run: | | ||
GIT_HASH=$(git rev-parse --short HEAD) | ||
echo "GIT_HASH=$GIT_HASH" >> ${GITHUB_ENV} | ||
GIT_DATE=$(git log -1 --format=%cd) | ||
echo "GIT_DATE=$GIT_DATE" >> ${GITHUB_ENV} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
|
@@ -108,6 +114,8 @@ jobs: | |
VITE_BAIDU_STATISTICS=${{ secrets.VITE_BAIDU_STATISTICS }} | ||
VITE_DOMAIN=${{ secrets.VITE_DOMAIN }} | ||
VITE_SENTRY_DSN=${{ secrets.VITE_SENTRY_DSN }} | ||
GIT_HASH=${{ env.GIT_HASH }} | ||
GIT_DATE=${{ env.GIT_DATE }} | ||
- name: Docker Hub README & description sync | ||
uses: meeDamian/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { execSync } from 'child_process' | ||
|
||
interface GitInfo { | ||
gitHash?: string | ||
gitDate?: string | ||
} | ||
|
||
function getGitInfo(): GitInfo { | ||
let gitHash = process.env.GIT_HASH | ||
let gitDate = process.env.GIT_DATE | ||
|
||
if (!gitHash) { | ||
try { | ||
gitHash = execSync('git rev-parse HEAD').toString().trim().slice(0, 8) | ||
const gitDateStr = execSync('git log -1 --format=%cd').toString().trim() | ||
gitDate = new Date(gitDateStr).toISOString() | ||
} catch (error) { | ||
console.error('Failed to get Git commit hash and date:', error) | ||
gitHash = 'unknown' | ||
gitDate = 'unknown' | ||
} | ||
} | ||
|
||
return { gitHash, gitDate } | ||
} | ||
|
||
export { getGitInfo } |