diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c424164..dd3d3e3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -49,7 +49,7 @@ jobs: echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV - name: Publish NPM package - run: ./scripts/publish_package.sh + run: ../scripts/publish_package.sh env: BRANCH: ${{ env.BRANCH }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -103,7 +103,7 @@ jobs: echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV - name: Publish NPM package - run: ./scripts/publish_package.sh + run: ../scripts/publish_package.sh env: BRANCH: ${{ env.BRANCH }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -157,7 +157,7 @@ jobs: echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV - name: Publish NPM package - run: ./scripts/publish_package.sh + run: ../scripts/publish_package.sh env: BRANCH: ${{ env.BRANCH }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -211,7 +211,7 @@ jobs: echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV - name: Publish NPM package - run: ./scripts/publish_package.sh + run: ../scripts/publish_package.sh env: BRANCH: ${{ env.BRANCH }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/python/scripts/generate_package_version.py b/python/scripts/generate_package_version.py index 3054ab9..27ed965 100755 --- a/python/scripts/generate_package_version.py +++ b/python/scripts/generate_package_version.py @@ -10,7 +10,7 @@ def calculate_version(release_version): parts = release_version.strip().split('-') [main_part, tail_part] = [parts[0], '-'.join(parts[1:])] tail_parts = tail_part.split('.') - [branch, build_number] = ['.'.join(tail_parts[:-1]), tail_part[-1]] + [branch, build_number] = ['.'.join(tail_parts[:-1]), tail_parts[-1]] if branch == 'stable': if int(build_number) == 0: return main_part diff --git a/typescript/ethers-v5/scripts/publish_package.sh b/typescript/ethers-v5/scripts/publish_package.sh deleted file mode 100755 index 6387ac5..0000000 --- a/typescript/ethers-v5/scripts/publish_package.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -set -e - -USAGE_MSG='Usage: BRANCH=[BRANCH] NODE_AUTH_TOKEN=[TOKEN] publish_package.sh' -if [ -z "$BRANCH" ] -then - (>&2 echo 'You should provide a branch') - echo "$USAGE_MSG" - exit 1 -fi -if [ -z "$NODE_AUTH_TOKEN" ] -then - (>&2 echo 'You should provide a node auth token') - echo "$USAGE_MSG" - exit 2 -fi - -cd "$(dirname "$0")/.." - -BRANCH=$(echo $BRANCH | tr [:upper:] [:lower:] | tr -d [:space:]) -VERSION=$(BRANCH=$BRANCH CURRENT=true "../scripts/calculate_version.sh") - -TAG="" -if ! [[ $BRANCH == 'stable' ]] -then - TAG="--tag $BRANCH" -fi - -if [[ "$VERSION" == *-stable.0 ]] -then - VERSION=${VERSION%-stable.0} -fi - -echo "Using $VERSION as a new version" - -# write a new version to the package.json -jq -c ".version = \"$VERSION\"" package.json > package.json.new -mv package.json.new package.json - -# set reference to the base package -yarn remove @skalenetwork/skale-contracts && yarn add @skalenetwork/skale-contracts@$VERSION - -yarn config set npmAuthToken "$NODE_AUTH_TOKEN" -yarn npm publish --access public $TAG diff --git a/typescript/ethers-v6/scripts/publish_package.sh b/typescript/ethers-v6/scripts/publish_package.sh deleted file mode 100755 index 6387ac5..0000000 --- a/typescript/ethers-v6/scripts/publish_package.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -set -e - -USAGE_MSG='Usage: BRANCH=[BRANCH] NODE_AUTH_TOKEN=[TOKEN] publish_package.sh' -if [ -z "$BRANCH" ] -then - (>&2 echo 'You should provide a branch') - echo "$USAGE_MSG" - exit 1 -fi -if [ -z "$NODE_AUTH_TOKEN" ] -then - (>&2 echo 'You should provide a node auth token') - echo "$USAGE_MSG" - exit 2 -fi - -cd "$(dirname "$0")/.." - -BRANCH=$(echo $BRANCH | tr [:upper:] [:lower:] | tr -d [:space:]) -VERSION=$(BRANCH=$BRANCH CURRENT=true "../scripts/calculate_version.sh") - -TAG="" -if ! [[ $BRANCH == 'stable' ]] -then - TAG="--tag $BRANCH" -fi - -if [[ "$VERSION" == *-stable.0 ]] -then - VERSION=${VERSION%-stable.0} -fi - -echo "Using $VERSION as a new version" - -# write a new version to the package.json -jq -c ".version = \"$VERSION\"" package.json > package.json.new -mv package.json.new package.json - -# set reference to the base package -yarn remove @skalenetwork/skale-contracts && yarn add @skalenetwork/skale-contracts@$VERSION - -yarn config set npmAuthToken "$NODE_AUTH_TOKEN" -yarn npm publish --access public $TAG diff --git a/typescript/base/scripts/publish_package.sh b/typescript/scripts/publish_package.sh similarity index 97% rename from typescript/base/scripts/publish_package.sh rename to typescript/scripts/publish_package.sh index b9d8969..f218c3a 100755 --- a/typescript/base/scripts/publish_package.sh +++ b/typescript/scripts/publish_package.sh @@ -16,8 +16,6 @@ then exit 2 fi -cd "$(dirname "$0")/.." - BRANCH=$(echo $BRANCH | tr [:upper:] [:lower:] | tr -d [:space:]) VERSION=$(BRANCH=$BRANCH "../scripts/calculate_version.sh")