Skip to content

Commit

Permalink
fix: changed workflow copy and publish script (#136)
Browse files Browse the repository at this point in the history
* fix: changed workflow copy and publish script

* fix: changed workflow copy and publish script
  • Loading branch information
rlajous authored Oct 4, 2024
1 parent a9d7528 commit ebe90dc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npm_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
build_and_publish:
build_and_publish_production_release:
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm_publish_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:
actions: write

jobs:
build_and_publish:
build_and_publish_beta_tag:
runs-on: ubuntu-latest

steps:
Expand Down
35 changes: 18 additions & 17 deletions publish-update-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ for pkg in "${DIRS[@]}"; do
current_version=$(jq -r '.version' $pkg/package.json)
remote_version=$(npm view $pkg_name version 2>/dev/null)

# Change to the directory
if ! cd "$pkg"; then
echo "Error: Unable to change to directory: packages/$pkg"
exit 1
fi

# Run the build command
if ! npm run build; then
echo "Error: Failed to run 'npm run build' in directory: packages/$pkg"
exit 1
fi

# Check if the package exists remotely or if the version has changed
if [ -z "$remote_version" ] || [ "$current_version" != "$remote_version" ]; then
if [ -z "$remote_version" ]; then
Expand All @@ -15,30 +27,19 @@ for pkg in "${DIRS[@]}"; do
echo "Detected version change in $pkg: $remote_version -> $current_version"
fi

# Change to the directory
if ! cd "$pkg"; then
echo "Error: Unable to change to directory: packages/$pkg"
exit 1
fi

# Run the build command
if ! npm run build; then
echo "Error: Failed to run 'npm run build' in directory: packages/$pkg"
exit 1
fi

# Run the publish command
if ! npm publish --access public; then
echo "Error: Failed to run 'npm publish --access public' in directory: packages/$pkg"
exit 1
fi

# Change back to the original directory
if ! cd - > /dev/null; then
echo "Error: Unable to change back to original directory"
exit 1
fi
else
echo "No version change detected in $pkg"
fi

# Change back to the original directory
if ! cd - > /dev/null; then
echo "Error: Unable to change back to original directory"
exit 1
fi
done

0 comments on commit ebe90dc

Please sign in to comment.