Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzdogan committed Oct 29, 2024
2 parents d08bb25 + 6e33a16 commit b0e2516
Show file tree
Hide file tree
Showing 38 changed files with 2,683 additions and 1,740 deletions.
10 changes: 5 additions & 5 deletions .circleci/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ workflows:
- monitor-e2e-holesky
- verification-e2e-sepolia
- verification-e2e-holesky
s3-backup-check:
when:
equal: [ master, << pipeline.git.branch >> ]
jobs:
- check-s3-backup
# s3-backup-check:
# when:
# equal: [ master, << pipeline.git.branch >> ]
# jobs:
# - check-s3-backup
etherscan-instances:
jobs:
- check-etherscan-instances
Expand Down
73 changes: 47 additions & 26 deletions .circleci/scripts/publish_to_npm.sh
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
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit b0e2516

Please sign in to comment.