Skip to content

Commit

Permalink
Refactor just recipes (#20)
Browse files Browse the repository at this point in the history
Add `push-tag` recipe.
Update `release` recipe.

---------

Co-authored-by: Fero <[email protected]>
  • Loading branch information
pavel-kuznetsov-hypertrack and ferologics authored Jun 6, 2024
1 parent 1eca373 commit 710d67c
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.2.cjs
53 changes: 49 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
alias pt := push-tag
alias v := version

REPOSITORY_NAME := "sdk-expo"

# Source: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
# \ are escaped
SEMVER_REGEX := "(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?"

build:
yarn expo-module clean
yarn expo-module build
Expand All @@ -7,12 +16,48 @@ clean:
npx yarn cache clean --force
rm -rf node_modules ~/Library/Developer/Xcode/DerivedData

release:
npm publish --dry-run
@echo "THIS IS DRY RUN. Check if everything is ok and then run 'npm publish'. Checklist:"
@echo "\t- check the release steps in CONTRIBUTING"
open-github-prs:
open "https://github.com/hypertrack/{{REPOSITORY_NAME}}/pulls"

open-github-releases:
open "https://github.com/hypertrack/{{REPOSITORY_NAME}}/releases"

push-tag:
#!/usr/bin/env sh
set -euo pipefail
if [ $(git symbolic-ref --short HEAD) = "main" ] ; then
VERSION=$(just version)
git tag $VERSION
git push origin $VERSION
just _open-github-release-data
else
echo "You are not on main branch"
fi
release publish="dry-run":
#!/usr/bin/env sh
set -euo pipefail
VERSION=$(just version)
if [ {{publish}} = "publish" ]; then
BRANCH=$(git branch --show-current)
if [ $BRANCH != "main" ]; then
echo "You must be on main branch to publish a new version (current branch: $BRANCH))"
exit 1
fi
echo "Are you sure you want to publish version $VERSION? (y/N)"
just _ask-confirm
open "https://www.npmjs.com/package/hypertrack-sdk-expo/v/$VERSION"
else
npm publish --dry-run
fi
setup:
npx yarn
npx expo install --yarn

version:
@cat package.json | grep version | head -n 1 | grep -o -E '{{SEMVER_REGEX}}'

_open-github-release-data:
code CHANGELOG.md
just open-github-releases

0 comments on commit 710d67c

Please sign in to comment.