diff --git a/.travis.yml b/.travis.yml index e9f6680a..4d796af7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,17 @@ git: if: tag != edge stages: - test + - name: clean + if: (NOT type IN (pull_request)) AND (branch = master) - name: deploy if: (NOT type IN (pull_request)) AND (branch = master) jobs: include: + - stage: clean + name: Remove Github Release + os: linux + dist: bionic + script: .travis/remove-edge.sh - stage: test name: macOS os: osx diff --git a/.travis/remove-edge.sh b/.travis/remove-edge.sh new file mode 100755 index 00000000..4321ff58 --- /dev/null +++ b/.travis/remove-edge.sh @@ -0,0 +1,23 @@ +#!/bin/sh -xe + +sudo apt-get update -qq +sudo apt-get -y install jq + +old_release=$(curl \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/solvespace/solvespace/releases/tags/edge \ + | jq -r ".url") + +if [ -z "$old_release" ]; then + curl \ + -X DELETE \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token $GITHUB_TOKEN" \ + "$old_release" +fi + +curl \ + -X DELETE \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token $GITHUB_TOKEN" \ + https://api.github.com/repos/solvespace/solvespace/git/refs/tags/edge