-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
2,683 additions
and
1,740 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
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 |
---|---|---|
@@ -1,35 +1,56 @@ | ||
#!/bin/bash | ||
|
||
BYTECODE_UTILS_LOCAL_VERSION=$(cat packages/bytecode-utils/package.json \ | ||
| grep version \ | ||
| head -1 \ | ||
| awk -F: '{ print $2 }' \ | ||
| sed 's/[",]//g' \ | ||
| tr -d '[[:space:]]') | ||
# Set npm auth token | ||
npm config set //registry.npmjs.org/:_authToken=${NPM_TOKEN} | ||
|
||
BYTECODE_UTILS_NPM_VERSION=$(npm view @ethereum-sourcify/bytecode-utils dist-tags.latest) | ||
# Define package directories and their corresponding npm package names, e.g. | ||
# packages/bytecode-utils:@ethereum-sourcify/bytecode-utils | ||
packages=( | ||
"packages/bytecode-utils:@ethereum-sourcify/bytecode-utils" | ||
"packages/lib-sourcify:@ethereum-sourcify/lib-sourcify" | ||
"services/server:@ethereum-sourcify/server" | ||
) | ||
|
||
LIB_SOURCIFY_LOCAL_VERSION=$(cat packages/lib-sourcify/package.json \ | ||
| grep version \ | ||
| head -1 \ | ||
| awk -F: '{ print $2 }' \ | ||
| sed 's/[",]//g' \ | ||
| tr -d '[[:space:]]') | ||
# Publish packages | ||
for package in "${packages[@]}"; do | ||
IFS=':' read -r local_path npm_package <<<"$package" | ||
if [[ $CIRCLE_TAG == ${npm_package}* ]]; then # Only publish if tag starts with package name. Otherwise it will publish all at once. | ||
echo "$CIRCLE_TAG matches $npm_package, publishing $npm_package" | ||
else | ||
echo "Skipping $npm_package as CIRCLE_TAG doesn't start with $npm_package" | ||
continue | ||
fi | ||
|
||
LIB_SOURCIFY_NPM_VERSION=$(npm view @ethereum-sourcify/lib-sourcify dist-tags.latest) | ||
publish_if_new_version "$local_path" "$npm_package" | ||
done | ||
|
||
npm config set //registry.npmjs.org/:_authToken=${NPM_TOKEN} | ||
# Helper Functions | ||
# ---------------- | ||
|
||
if [ $BYTECODE_UTILS_LOCAL_VERSION = $BYTECODE_UTILS_NPM_VERSION ]; then | ||
echo "@ethereum-sourcify/bytecode-utils:" | ||
echo "Latest npm version is equal to current package version. Up the version to publish to npm." | ||
else | ||
npm publish packages/bytecode-utils/ --verbose --access=public | ||
fi | ||
# Function to get local version | ||
get_local_version() { | ||
cat "$1/package.json" | | ||
grep version | | ||
head -1 | | ||
awk -F: '{ print $2 }' | | ||
sed 's/[",]//g' | | ||
tr -d '[[:space:]]' | ||
} | ||
|
||
# Function to get npm version | ||
get_npm_version() { | ||
npm view "$1" dist-tags.latest | ||
} | ||
|
||
# Function to publish package if versions differ | ||
publish_if_new_version() { | ||
local_version=$(get_local_version "$1") | ||
npm_version=$(get_npm_version "$2") | ||
|
||
if [ $LIB_SOURCIFY_LOCAL_VERSION = $LIB_SOURCIFY_NPM_VERSION ]; then | ||
echo "@ethereum-sourcify/lib-sourcify:" | ||
if [ "$local_version" = "$npm_version" ]; then | ||
echo "$2:" | ||
echo "Latest npm version is equal to current package version. Up the version to publish to npm." | ||
else | ||
npm publish packages/lib-sourcify/ --verbose --access=public | ||
fi | ||
else | ||
npm publish -w "$2" --verbose --access=public | ||
fi | ||
} |
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 |
---|---|---|
|
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. | |
|
||
This CHANGELOG will contain monorepo related changes such as CI configs, shared dependencies and the development setup. | ||
|
||
## [email protected] - 2024-10-29 | ||
|
||
- Publish sourcify-server to npm on CI runs | ||
- Turn off S3 backup check tests temporarily | ||
- Update packages | ||
|
||
## [email protected] - 2024-10-14 | ||
|
||
- Build before testing in CI | ||
|
Oops, something went wrong.