[go: nahoru, domu]

Skip to content

Commit

Permalink
Update release script similarly
Browse files Browse the repository at this point in the history
  • Loading branch information
nvie committed Jun 27, 2024
1 parent 7d30279 commit 7a03cb9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 29 deletions.
35 changes: 9 additions & 26 deletions .github/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,31 @@
set -eu

echo "Running release scripts..."
PACKAGE_DIRS=(
"packages/liveblocks-core"
"packages/liveblocks-client"
"packages/liveblocks-node"
"packages/liveblocks-react"
"packages/liveblocks-redux"
"packages/liveblocks-zustand"
"packages/liveblocks-yjs"
"packages/liveblocks-react-ui"
"packages/liveblocks-react-lexical"
"packages/liveblocks-node-lexical"
"packages/create-liveblocks-app"
"packages/liveblocks-codemod"
)

err () {
echo "$@" >&2
}


usage () {
err "usage: release.sh [-V <version>] [-h]"
err "usage: release.sh [-h] [-V <version>] <pkgdir> [<pkgdir>...]"
err
err "Prepare a release by updating files in this repo."
err "Run this prior to publishing to NPM."
err ""
err " -V the new NPM version"
err ""
err "Create a release for the CI to publish."
err
err "Options:"
err "-V <version> Set version to publish (default: prompt)"
err "Example: 1.0.0 or 1.0.1-beta1"
}

VERSION=
while getopts V:t:h flag; do
while getopts V:h flag; do
case "$flag" in
V) VERSION=$OPTARG;;
*) usage; exit 2;;
esac
done
shift "$(($OPTIND - 1))"

if [ "$#" -ne 0 ]; then
err "Unknown arguments: $@"
if [ "$#" -eq 0 ]; then
usage
exit 2
fi
Expand All @@ -59,7 +42,7 @@ check_is_valid_version () {
ROOT="$(git rev-parse --show-toplevel)"

all_published_pkgnames () {
for pkgdir in ${PACKAGE_DIRS[@]}; do
for pkgdir in "$@"; do
jq -r .name "$ROOT/$pkgdir/package.json"
done
}
Expand Down Expand Up @@ -104,7 +87,7 @@ check_is_valid_version "$VERSION"
# Set up turbo
npm install

for PKGDIR in "${PACKAGE_DIRS[@]}"; do
for PKGDIR in "$@"; do
update_package_version "$PKGDIR" "$VERSION"
done

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/publish-cli-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ jobs:
- name: Prepare release
env:
VERSION: ${{steps.version.outputs.value}}
run: ./.github/scripts/release.sh -V "$VERSION"
run:
./.github/scripts/release.sh -V "$VERSION"
"tools/create-liveblocks-app" "tools/liveblocks-codemod"

- name: Build all CLI tools
run: |
Expand All @@ -90,7 +92,7 @@ jobs:
NPM_TAG: ${{ steps.npm_tag.outputs.value }}
run:
./.github/scripts/publish.sh -V "$VERSION" -t "$NPM_TAG"
"packages/create-liveblocks-app" "packages/liveblocks-codemod"
"tools/create-liveblocks-app" "tools/liveblocks-codemod"

- name:
Creating release tag, don't forget to fill the changelog if necessary!
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ jobs:
- name: Prepare release
env:
VERSION: ${{steps.version.outputs.value}}
run: ./.github/scripts/release.sh -V "$VERSION"
run:
./.github/scripts/release.sh -V "$VERSION" "packages/liveblocks-core"
"packages/liveblocks-client" "packages/liveblocks-node"
"packages/liveblocks-react" "packages/liveblocks-redux"
"packages/liveblocks-zustand" "packages/liveblocks-yjs"
"packages/liveblocks-react-ui" "packages/liveblocks-react-lexical"
"packages/liveblocks-node-lexical"

- name: Build all packages
run: |
Expand Down

0 comments on commit 7a03cb9

Please sign in to comment.