Skip to content

Commit

Permalink
Merge fad2025 into ebd668d
Browse files Browse the repository at this point in the history
  • Loading branch information
wemeetagain authored Jun 1, 2022
2 parents ebd668d + fad2025 commit e8b120f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
if: needs.tag.outputs.is_rc == 'true'
steps:
- uses: actions/checkout@v2
- run: scripts/await-release.sh ${{ needs.tag.outputs.tag }} 900
- run: scripts/await-release.sh ${{ needs.tag.outputs.tag }} rc 900
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
if: needs.tag.outputs.is_stable == 'true'
steps:
- uses: actions/checkout@v2
- run: scripts/await-release.sh ${{ needs.tag.outputs.tag }} 900
- run: scripts/await-release.sh ${{ needs.tag.outputs.tag }} latest 900
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
Expand Down
11 changes: 6 additions & 5 deletions scripts/await-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ declare PACKAGE="@chainsafe/lodestar-cli"
# Using `npm view -j` to get all available versions as JSON
declare CMD_NPM="npm view -j $PACKAGE"

# Using `jq` to get the latest version
declare VERSION_LATEST=$($CMD_NPM | jq -r '."dist-tags".latest')
# Using `jq` to get the dist-tag version
declare VERSION_LATEST=$($CMD_NPM | jq -r ".\"dist-tags\".$DIST_TAG")

# Usage: scripts/await-release.sh $VERSION $TIMEOUT
declare VERSION_EXPECTED=$(echo $1 | tr -d 'v')
declare TIMEOUT=$2
declare DIST_TAG=$2
declare TIMEOUT=$3

declare TIME=0
declare SLEEP=5
Expand All @@ -23,7 +24,7 @@ declare SLEEP=5
### Note: that this script will already exit here in case everything is fine
### and only delay in case there is a discrepancy between the versions
while [[ "$VERSION_EXPECTED" != "$VERSION_LATEST" ]]; do
echo "Expected version $VERSION_EXPECTED does not match latest version $VERSION_LATEST in NPM registry. Trying again in $SLEEP..."
echo "Expected version $VERSION_EXPECTED does not match $DIST_TAG version $VERSION_LATEST in NPM registry. Trying again in $SLEEP..."
TIME=$(($TIME+$SLEEP))

# Allow the CI to timeout
Expand All @@ -35,5 +36,5 @@ while [[ "$VERSION_EXPECTED" != "$VERSION_LATEST" ]]; do

# Force clean cache before retrying
npm cache clean --force
VERSION_LATEST=$($CMD_NPM | jq -r '."dist-tags".latest')
VERSION_LATEST=$($CMD_NPM | jq -r ".\"dist-tags\".$DIST_TAG")
done

0 comments on commit e8b120f

Please sign in to comment.