Skip to content

Commit

Permalink
ci: get dev github sha
Browse files Browse the repository at this point in the history
  • Loading branch information
shairez committed Jul 29, 2024
1 parent fa0e8ac commit 5f4f84c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ export async function getVersion(distTag?: string) {
if (!distTag || distTag === 'dev') {
v += '-dev';
// add the current short commit hash
// when in github actions, get from environment
try {
const gitCommit = await execa('git', ['rev-parse', 'HEAD']);
v += `+${gitCommit.stdout.slice(0, 7)}`;
const gitSha = process.env.GITHUB_SHA;
const gitCommit = gitSha || (await execa('git', ['rev-parse', 'HEAD'])).stdout;
v += `+${gitCommit.slice(0, 7)}`;
} catch (e) {
// git not found
}
Expand Down

0 comments on commit 5f4f84c

Please sign in to comment.