From 1b2d47cd8603b017de1b715c84502d57ed0fc860 Mon Sep 17 00:00:00 2001 From: Maximilian Federle Date: Wed, 18 Nov 2020 10:53:14 +0100 Subject: [PATCH] Travis: deploy tagged commits & edge tagging fixes With the recent Travis changes, we prevented the deploy stage from running for tagged commits as branch=tag for tagged commits. Fix this by also running deploy for tagged commits. Furthermore, clean up .travis.yml by pulling the edge tagging logic into a separate script. A logic change is introduced to prevent git tag --force being run on set tags as this would turn annotated tags into lightweight tags. --- .travis.yml | 20 ++++---------------- .travis/tag-edge.sh | 8 ++++++++ 2 files changed, 12 insertions(+), 16 deletions(-) create mode 100755 .travis/tag-edge.sh diff --git a/.travis.yml b/.travis.yml index 4d796af7..b9f64899 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ stages: - name: clean if: (NOT type IN (pull_request)) AND (branch = master) - name: deploy - if: (NOT type IN (pull_request)) AND (branch = master) + if: (NOT type IN (pull_request)) AND (branch = master OR tag IS present) jobs: include: - stage: clean @@ -29,11 +29,7 @@ jobs: osx_image: xcode12.2 install: ".travis/install-macos.sh" script: ".travis/build-macos.sh release && .travis/sign-macos.sh" - before_deploy: - - git config --local user.name "solvespace-cd" - - git config --local user.email "no-reply@solvespace.com" - - export TRAVIS_TAG=${TRAVIS_TAG:-edge} - - git tag --force $TRAVIS_TAG + before_deploy: source .travis/tag-edge.sh deploy: provider: releases skip_cleanup: true @@ -59,11 +55,7 @@ jobs: os: windows install: .travis/install-windows.sh script: .travis/build-windows.sh release - before_deploy: - - git config --local user.name "solvespace-cd" - - git config --local user.email "no-reply@solvespace.com" - - export TRAVIS_TAG=${TRAVIS_TAG:-edge} - - git tag --force $TRAVIS_TAG + before_deploy: source .travis/tag-edge.sh deploy: provider: releases skip_cleanup: true @@ -78,11 +70,7 @@ jobs: os: windows install: .travis/install-windows.sh script: .travis/build-windows.sh release openmp - before_deploy: - - git config --local user.name "solvespace-cd" - - git config --local user.email "no-reply@solvespace.com" - - export TRAVIS_TAG=${TRAVIS_TAG:-edge} - - git tag --force $TRAVIS_TAG + before_deploy: source .travis/tag-edge.sh deploy: provider: releases skip_cleanup: true diff --git a/.travis/tag-edge.sh b/.travis/tag-edge.sh new file mode 100755 index 00000000..8ce6a194 --- /dev/null +++ b/.travis/tag-edge.sh @@ -0,0 +1,8 @@ +#!/bin/sh -xe + +if [ -z "$TRAVIS_TAG" ]; then + git config --local user.name "solvespace-cd" + git config --local user.email "no-reply@solvespace.com" + export TRAVIS_TAG="edge" + git tag --force $TRAVIS_TAG +fi