Skip to content

Commit

Permalink
Merge pull request #4269 from connext/fix-build-workflow
Browse files Browse the repository at this point in the history
Fix build workflow
  • Loading branch information
just-a-node authored May 19, 2023
2 parents c740264 + fd957a8 commit 00b0b16
Showing 1 changed file with 21 additions and 63 deletions.
84 changes: 21 additions & 63 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ jobs:
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
VERSION=$(cat packages/agents/sdk/package.json | jq -r '.version')
if [[ "$VERSION" == *"-alpha"* ]]; then
tag="alpha"
elif [[ "$VERSION" == *"-beta"* ]]; then
tag="beta"
fi
workspaces=(
"packages/utils:@connext/nxtp-utils"
"packages/deployments/contracts:@connext/smart-contracts"
Expand All @@ -113,6 +105,13 @@ jobs:
workspace="${split_entry[1]}"
subpackage_version=$(cat $directory/package.json | jq -r '.version')
tag=""
if [[ "$subpackage_version" == *"-alpha"* ]]; then
tag="alpha"
elif [[ "$subpackage_version" == *"-beta"* ]]; then
tag="beta"
fi
echo "Checking $workspace for existing version..."
npm_package_info=$(npm view $workspace versions --json)
Expand Down Expand Up @@ -143,14 +142,6 @@ jobs:
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
VERSION=$(cat packages/deployments/contracts/package.json | jq -r '.version')
if [[ "$VERSION" == *"-alpha"* ]]; then
tag="alpha"
elif [[ "$VERSION" == *"-beta"* ]]; then
tag="beta"
fi
workspaces=(
"packages/utils:@connext/nxtp-utils"
"packages/deployments/contracts:@connext/smart-contracts"
Expand All @@ -162,6 +153,13 @@ jobs:
workspace="${split_entry[1]}"
subpackage_version=$(cat $directory/package.json | jq -r '.version')
tag=""
if [[ "$subpackage_version" == *"-alpha"* ]]; then
tag="alpha"
elif [[ "$subpackage_version" == *"-beta"* ]]; then
tag="beta"
fi
echo "Checking $workspace for existing version..."
npm_package_info=$(npm view $workspace versions --json)
Expand Down Expand Up @@ -192,14 +190,6 @@ jobs:
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
VERSION=$(cat packages/agents/chain-abstraction/package.json | jq -r '.version')
if [[ "$VERSION" == *"-alpha"* ]]; then
tag="alpha"
elif [[ "$VERSION" == *"-beta"* ]]; then
tag="beta"
fi
workspaces=(
"packages/utils:@connext/nxtp-utils"
"packages/agents/chain-abstraction:@connext/chain-abstraction"
Expand All @@ -211,6 +201,13 @@ jobs:
workspace="${split_entry[1]}"
subpackage_version=$(cat $directory/package.json | jq -r '.version')
tag=""
if [[ "$subpackage_version" == *"-alpha"* ]]; then
tag="alpha"
elif [[ "$subpackage_version" == *"-beta"* ]]; then
tag="beta"
fi
echo "Checking $workspace for existing version..."
npm_package_info=$(npm view $workspace versions --json)
Expand All @@ -236,45 +233,6 @@ jobs:
fi
done
- name: Extract version, determine tag, and publish chain-abstraction
if: ${{ startsWith(github.ref, 'refs/tags/chain-abstraction-v') }}
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
VERSION=$(cat packages/agents/chain-abstraction/package.json | jq -r '.version')
if [[ "$VERSION" == *"-alpha"* ]]; then
tag="alpha"
elif [[ "$VERSION" == *"-beta"* ]]; then
tag="beta"
fi
workspaces=(
"packages/utils:@connext/nxtp-utils"
"packages/agents/chain-abstraction:@connext/chain-abstraction"
)
for entry in "${workspaces[@]}"; do
IFS=":"; read -ra split_entry <<< "$entry"
directory="${split_entry[0]}"
workspace="${split_entry[1]}"
subpackage_version=$(cat $directory/package.json | jq -r '.version')
echo "Checking $workspace for existing version..."
published_version=$(npm view $workspace version)
if [[ "$published_version" != "$subpackage_version" ]]; then
echo "Publishing $workspace with version $subpackage_version"
if [[ "$tag" ]]; then
yarn workspace $workspace npm publish --access public --tag $tag
else
yarn workspace $workspace npm publish --access public
fi
else
echo "Skipping $workspace as version $subpackage_version already exists"
fi
done
build-and-push-router-publisher-image:
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/testnet-prod' || github.ref == 'refs/heads/prod'
env:
Expand Down

0 comments on commit 00b0b16

Please sign in to comment.