bpmn-js/tasks/wiredeps

33 lines
919 B
Bash
Executable File

#!/bin/bash
FEATURE_BRANCH=
# https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables
# skip master / backport branches and tags
if [[ "$GITHUB_REF" =~ ^refs/heads/(master$|[0-9]+\.x) ]] || [[ "$GITHUB_REF" =~ ^refs/tags/ ]]; then
echo "Skip wiredeps: master/backport branch";
exit 0;
fi
# skip PR builds targeting master or backport branches
if [[ "$GITHUB_BASE_REF" =~ ^(master$|[0-9]+\.x) ]]; then
echo "Skip wiredeps: targets master/backport branch";
exit 0;
fi
# GITHUB_HEAD_REF is set for pull request
FEATURE_BRANCH=$([ $GITHUB_HEAD_REF != "" ] && echo $GITHUB_HEAD_REF || echo "$GITHUB_REF" | cut -d"/" -f3)
echo "Attempting to install diagram-js@$FEATURE_BRANCH";
npm install "diagram-js@bpmn-io/diagram-js#$FEATURE_BRANCH";
if [ $? -ne 0 ]; then
echo "Falling back to diagram-js@develop";
npm install "diagram-js@bpmn-io/diagram-js#develop";
fi