Skip to content

Commit

Permalink
feat: add logic for creating proper versions
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonrybczak committed Jul 3, 2024
1 parent 2dbe50c commit bc4e259
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/nigthly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,25 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
npx lerna version --conventional-commits --conventional-prerelease --preid alpha --yes
npx lerna publish from-git --no-verify-access --no-changelog --yes
# Get the current commit hash
COMMIT_HASH=$(git rev-parse --short HEAD)
# Get the current date
DATE=$(date +%Y%m%d)
# Get the version from package.json and split into an array
IFS='.' read -ra VERSION_ARRAY <<< "$(node -p -e "require('./packages/cli/package.json').version")"
MAJOR_VERSION=${VERSION_ARRAY[0]}
MINOR_VERSION=${VERSION_ARRAY[1]}
PATCH_VERSION=${VERSION_ARRAY[2]}
# If PATCH_VERSION contains a '-', strip everything after it
if echo $PATCH_VERSION | grep -q '-'; then
PATCH_VERSION=${PATCH_VERSION%%-*}
fi
# Create a version string that includes the commit hash and date
VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-${PRERELEASE_NAME}-${DATE}-${COMMIT_HASH}"
npx lerna version --force-publish --no-push --allow-branch '*' --preid $VERSION --yes
npx lerna publish --tag nightly from-git --no-verify-access --no-changelog --yes

0 comments on commit bc4e259

Please sign in to comment.