-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.bash
More file actions
29 lines (22 loc) · 842 Bytes
/
Copy pathtest.bash
File metadata and controls
29 lines (22 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Set the package and branch details
PACKAGE_NAME="@ronin/compiler"
BRANCH_NAME="corny/remove-experimental"
# Output the branch name
echo "Branch Name: $BRANCH_NAME"
# Retrieve all versions of the package in JSON format
VERSIONS=$(npm view $PACKAGE_NAME versions --json)
# Check if any versions were retrieved
if [ -z "$VERSIONS" ]; then
echo "No versions found for $PACKAGE_NAME."
exit 0
fi
# Filter versions matching the branch-specific pattern
MATCHING_VERSIONS=$(echo "$VERSIONS" | tr -d '[]" ' | tr ',' '\n' | grep -F -- "-${BRANCH_NAME}-experimental")
# Check if any matching versions were found
if [ -z "$MATCHING_VERSIONS" ]; then
echo "No versions to unpublish for branch $BRANCH_NAME."
exit 0
fi
# Output the matching versions to GitHub Actions output
echo "versions=$MATCHING_VERSIONS" >> $GITHUB_OUTPUT