|
1 | | -#!/bin/bash -e |
| 1 | +#!/usr/bin/env bash -e |
2 | 2 |
|
3 | 3 | LATEST_VERSION=$(npm view @chainlink/external-adapter-framework version)'' |
4 | 4 |
|
@@ -56,13 +56,22 @@ echo "Running yarn..." |
56 | 56 | yarn > /dev/null |
57 | 57 |
|
58 | 58 | 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 |
66 | 75 | else |
67 | 76 | echo "No adapters were changed, no need to create a changeset." |
68 | 77 | fi |
|
0 commit comments