Skip to content

Commit

Permalink
feat: support tags
Browse files Browse the repository at this point in the history
  • Loading branch information
heueristik committed Jun 16, 2023
1 parent b83a276 commit c6b7cf5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/contracts-versions/create-contract-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ async function checkForUncommittedChanges() {
}
}

async function getCurrentBranch() {
const {stdout} = await exec('git branch --show-current', {cwd: contractsDir});
async function getCurrentTagOrBranch() {
const {stdout} = await exec(
'git describe --exact-match --tags 2> /dev/null || git branch --show-current',
{cwd: contractsDir}
);
return stdout.trim();
}

Expand Down Expand Up @@ -66,7 +69,7 @@ async function copyContracts(versionName: string) {
async function createVersions() {
await checkForUncommittedChanges();

const currentBranch = await getCurrentBranch();
const currentBranch = await getCurrentTagOrBranch();

for (const version in commitHashes.versions) {
const versionCommit = commitHashes.versions[version] as string;
Expand Down

0 comments on commit c6b7cf5

Please sign in to comment.