Skip to content

Commit

Permalink
Try to fix release script
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcer committed Jan 8, 2025
1 parent 7e665fe commit 1e55119
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 1 addition & 3 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ default:

# Release a new version for `setup-moonbit`
release *OPTIONS:
@overlay use {{ join(SETUP_MOONBIT_PATH, 'nu', 'common.nu') }}; \
overlay use {{ join(SETUP_MOONBIT_PATH, 'nu', 'release.nu') }}; \
git-check --check-repo=1 {{SETUP_MOONBIT_PATH}}; \
@overlay use {{ join(SETUP_MOONBIT_PATH, 'nu', 'release.nu') }}; \
make-release {{OPTIONS}}

# Fetch official install scripts
Expand Down
11 changes: 11 additions & 0 deletions nu/release.nu
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,14 @@ export def 'make-release' [
git checkout $releaseVer; git tag $majorTag
git push origin $majorTag $releaseVer --force
}

# Check if a git repo has the specified ref: could be a branch or tag, etc.
export def has-ref [
ref: string # The git ref to check
] {
let checkRepo = (do -i { git rev-parse --is-inside-work-tree } | complete)
if not ($checkRepo.stdout =~ 'true') { return false }
# Brackets were required here, or error will occur
let parse = (do -i { git rev-parse --verify -q $ref } | complete)
if ($parse.stdout | is-empty) { false } else { true }
}

0 comments on commit 1e55119

Please sign in to comment.