ci: extract + fix await-published logic

This commit is contained in:
Nico Rehwaldt 2021-09-16 10:17:02 +02:00 committed by MaxTru
parent fea7eebb15
commit 723fe1e4ac
2 changed files with 22 additions and 17 deletions

View File

@ -19,23 +19,9 @@ jobs:
- name: Set TAG - name: Set TAG
run: echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV run: echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Wait for published - name: Wait for published
run: | env:
i=0 PKG: 'bpmn-js@${{ env.TAG }}'
pkg="bpmn-js@${{ env.TAG }}" run: tasks/stages/await-published
until [ $i -gt 10 ]
do
echo "Checking for $pkg in npm registry..."
info=$(npm info $pkg)
if [[ "$info" != "" ]]; then
echo "Found."
break
fi
((i++))
sleep 15s
done
- name: Use Node.js - name: Use Node.js
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:

19
tasks/stages/await-published Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
set -eo pipefail
shopt -s inherit_errexit nullglob
i=0
pkg="$PKG"
until [ $i -gt 10 ]
do
echo "Checking for $pkg in npm registry ($((i+1))/10)"
info=$(npm info $pkg)
if [[ "$info" != "" ]]; then
echo "Found."
break
fi
i=$((var+1))
sleep 15s
done