From 8a40658b21f81f70cf11a4bb92825e8f6165618e Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Fri, 22 Jan 2021 14:29:59 +0100 Subject: [PATCH] chore: wire dependencies in GitHub action --- .github/workflows/CI.yml | 2 ++ tasks/wiredeps_github | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100755 tasks/wiredeps_github diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3236fa49..31b103d7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -28,6 +28,8 @@ jobs: ${{ runner.OS }}- - name: Install dependencies run: npm ci + - name: Wire dependencies + run: ./tasks/wiredeps_github - name: Build env: COVERAGE: 1 diff --git a/tasks/wiredeps_github b/tasks/wiredeps_github new file mode 100755 index 00000000..02d8bbc7 --- /dev/null +++ b/tasks/wiredeps_github @@ -0,0 +1,22 @@ +#!/bin/bash + +FEATURE_BRANCH= + +# https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables + +# skip default branch and tags +if [[ $GITHUB_REF =~ ^refs/heads/master$ ]] || [[ $GITHUB_REF =~ ^refs/tags/ ]]; then + exit 0; +fi + +FEATURE_BRANCH=$(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