-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add experimental package update scripts
- Loading branch information
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
name=$1 | ||
old_version=$2 | ||
new_version=$3 | ||
|
||
( | ||
cd "$name" || exit | ||
|
||
sed -i "s/$old_version/$new_version/" build.boot | ||
|
||
package_json=$(curl -sS "https://unpkg.com/$name@$new_version/package.json") | ||
scm=$(echo "$package_json" | jq -r '.repository.url') | ||
regex='https://github.com/([^/]*)/([^/]*)' | ||
[[ $scm =~ $regex ]] && organisation=${BASH_REMATCH[1]} | ||
|
||
changelog=$(curl -sS "https://raw.githubusercontent.com/$organisation/$name/master/CHANGELOG.md" | sed "/^## $new_version/,/^## .*/!d;//d") | ||
|
||
message="Update $name to $new_version\n\n## $old_version => $new_version\n$changelog" | ||
|
||
# FIXME: Need way to automatically accept changed checksums | ||
boot package | ||
|
||
git add build.boot boot-cljsjs-checksums.edn | ||
|
||
git checkout -b "$name-$new_version" | ||
git commit -m "$(echo -e "$message")" | ||
git push origin HEAD | ||
# TODO: Open pull request | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
for x in *; do | ||
if [[ -d $x ]]; then | ||
if [[ ! -f $x/build.boot ]]; then | ||
continue | ||
fi | ||
if [[ -f $x/disabled ]]; then | ||
continue | ||
fi | ||
|
||
# Skip packages not using unpkg | ||
if ! grep -q "unpkg.com" "$x/build.boot"; then | ||
continue | ||
fi | ||
|
||
artifact=${x//_[0-9]*/} | ||
# Skip old versions of packages, like jquery_1 or react_15 | ||
if [[ "$x" != "$artifact" ]]; then | ||
continue | ||
fi | ||
|
||
lib_version=$(grep "def +lib-version+" "$x/build.boot" | grep -o "\".*\"" | head -n1 | cut -d \" -f 2) | ||
|
||
location=$(curl -s --head "https://unpkg.com/$artifact/" | grep location:) | ||
latest_version=$(echo "$location" | grep -o "@[0-9.]*" | cut -c2-) | ||
|
||
if [[ $latest_version = "" ]]; then | ||
# if no response, e.g. folder name doesn't match unpkg, skip for now | ||
continue | ||
fi | ||
|
||
if [[ "$lib_version" != "$latest_version" ]]; then | ||
echo "$x, packaged lib version $lib_version, latest is $latest_version" | ||
./update-package.sh "$x" "$lib_version" "$latest_version" | ||
fi | ||
fi | ||
done |