From 4bafbe5d8b677050fe280036e907af8ec1c82fe7 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Wed, 22 Jan 2020 15:41:31 +0100 Subject: [PATCH] chore(project): automatically update website with every release --- .travis.yml | 4 ++++ tasks/stages/update-website | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 tasks/stages/update-website diff --git a/.travis.yml b/.travis.yml index b1bffaf4..f9896cce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,8 @@ jobs: script: './tasks/stages/update-examples' - stage: update demo script: './tasks/stages/update-demo' + - stage: update website + script: './tasks/stages/update-website' stages: - test @@ -25,4 +27,6 @@ stages: - name: update examples if: tag =~ ^v\d - name: update demo + if: tag =~ ^v\d + - name: update website if: tag =~ ^v\d \ No newline at end of file diff --git a/tasks/stages/update-website b/tasks/stages/update-website new file mode 100755 index 00000000..4318bcdd --- /dev/null +++ b/tasks/stages/update-website @@ -0,0 +1,34 @@ +#! /bin/bash + +# update bpmn-js version in the project + +PWD="$(pwd)" +WORKDIR="$(pwd)/tmp" +CLONE_DIR="$WORKDIR/bpmn.io" + +# create work dir +mkdir -p "$WORKDIR" + +git clone --depth=1 https://github.com/bpmn-io/bpmn.io.git "$CLONE_DIR" + +cd "$CLONE_DIR" + +echo "Updating toolkit version to $TRAVIS_TAG on bpmn.io" + +cat src/data/site.yml | tr "\r?\n" "\r" | sed -e "s#bpmnjs:\r version: [^\r]*\r#bpmnjs:\r version: $TRAVIS_TAG\r#" | tr "\r" "\n" > src/data/site.yml + +if [[ "x$SKIP_COMMIT" = "x" ]]; then + + git config user.email "$BPMN_IO_EMAIL" + git config user.name "$BPMN_IO_USERNAME" + git config push.default simple + + # add all resources + git add -A + git commit -m "chore(project): bump bpmn-js to $TRAVIS_TAG" + git push -q "https://$GITHUB_AUTH@github.com/bpmn-io/bpmn.io.git" &2>/dev/null +else + echo "Skipping commit (SKIP_COMMIT=$SKIP_COMMIT)" +fi + +cd "$PWD" \ No newline at end of file