Skip to content

Commit 7496de6

Browse files
committed
Create a changeset file per package on framework bump
1 parent 99d3814 commit 7496de6

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

packages/scripts/src/framework/version-bump.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -e
1+
#!/usr/bin/env bash -e
22

33
LATEST_VERSION=$(npm view @chainlink/external-adapter-framework version)''
44

@@ -56,13 +56,22 @@ echo "Running yarn..."
5656
yarn > /dev/null
5757

5858
if [ -s changed_eas.tmp ]; then
59-
# Generate changeset (manually for now, since the changesets CLI has no options to automate this part)
60-
changeset_name="$(cd packages/scripts && yarn node -e 'console.log(require("human-id").humanId({ separator: "-", capitalize: false }))').md"
61-
echo "Creating changeset ($changeset_name)..."
62-
touch .changeset/$changeset_name
63-
echo "---" >> .changeset/$changeset_name
64-
cat changed_eas.tmp >> .changeset/$changeset_name
65-
printf -- '---\n\nBumped framework version\n' >> .changeset/$changeset_name
59+
# We create a separate changeset file for each package so we don't enforce
60+
# releasing all packages at the same time.
61+
mapfile -t changeset_lines < changed_eas.tmp
62+
count=${#changeset_lines[@]}
63+
# Create changeset names with a single call to yarn node as calling it 100+
64+
# times is quite slow.
65+
mapfile -t changeset_names < <(cd packages/scripts && yarn node -e "
66+
const { humanId } = require('human-id')
67+
for (let i = 0; i < $count; i++) console.log(humanId({ separator: '-', capitalize: false }))
68+
")
69+
for i in "${!changeset_lines[@]}"; do
70+
# Generate changeset (manually for now, since the changesets CLI has no options to automate this part)
71+
changeset_filename="${changeset_names[$i]}.md"
72+
echo "Creating changeset ($changeset_filename)..."
73+
printf '%s\n%s\n%s\n\nBumped framework version\n' "---" "${changeset_lines[$i]}" "---" > ".changeset/$changeset_filename"
74+
done
6675
else
6776
echo "No adapters were changed, no need to create a changeset."
6877
fi

0 commit comments

Comments
 (0)