diff --git a/.appveyor.yml b/.appveyor.yml index 34b12825c8..4e3732214e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -33,11 +33,17 @@ build_script: test_script: - C:\msys64\usr\bin\bash -lc "exec 0/dev/null 2>&1; then + # macOS readlink doesn't support -f option + READLINK=greadlink +else + READLINK=readlink +fi # Travis can't publish releases to other repos (or stop mucking with the markdown description), so push releases directly -GO_PATH=$(realpath go) -PATH=$PATH:$GO_PATH/bin +export GOPATH=$($READLINK -f go) +PATH=$PATH:$GOPATH/bin go get github.com/itchio/gothub +# technically a race condition... +git fetch nightly --tags if git tag $LEAN_VERSION_STRING then - # technically a race condition... - git push nightly $LEAN_VERSION_STRING last_tag=$(git describe @^ --abbrev=0 --tags) echo -e "Changes since ${last_tag}:\n\n" > diff.md - ./script/diff_changelogs.py <(git show $last_tag:doc/changes.md) doc/changes.md >> diff.md + git show $last_tag:doc/changes.md > old.md + ./script/diff_changelogs.py old.md doc/changes.md >> diff.md + git push nightly $LEAN_VERSION_STRING gothub release -s $GH_TOKEN -u leanprover -r lean-nightly -t $LEAN_VERSION_STRING -d - --pre-release < diff.md else # make sure every runner is building the same commit - [ $(git parse-rev HEAD) == $(git parse-rev $LEAN_VERSION_STRING) ] || exit 1 + [ $(git rev-parse HEAD) == $(git rev-parse $LEAN_VERSION_STRING) ] || exit 1 fi gothub upload -s $GH_TOKEN -u leanprover -r lean-nightly -t $LEAN_VERSION_STRING -n "$(basename $1)" -f "$1" diff --git a/script/diff_changelogs.py b/script/diff_changelogs.py index 16228bab84..201929447f 100755 --- a/script/diff_changelogs.py +++ b/script/diff_changelogs.py @@ -1,4 +1,4 @@ -#! /bin/env python3 +#!/usr/bin/env python3 import collections import re diff --git a/script/setup_nightly.sh b/script/setup_nightly.sh old mode 100644 new mode 100755 index 46d7e50a39..2a991fd01f --- a/script/setup_nightly.sh +++ b/script/setup_nightly.sh @@ -1,13 +1,18 @@ -#!/bin/bash - -set -exu +#!/bin/false +# script should be sourced git remote add nightly "https://$GH_TOKEN@github.com/leanprover/lean-nightly.git" git fetch nightly --tags +export LEAN_VERSION_STRING="nightly-$(date -uI)" + # do nothing if commit is already tagged -if [ ! git describe --exact-match --tags HEAD >& /dev/null ] +if git checkout $LEAN_VERSION_STRING || ! git name-rev --name-only --tags --no-undefined HEAD then - LEAN_VERSION_STRING="nightly-$(date -uI)" + # write into file since we repeatedly open and close shells on AppVeyor + cat < ./nightly.sh +export LEAN_VERSION_STRING=$LEAN_VERSION_STRING +EOF + . ./nightly.sh OPTIONS+=" -DLEAN_SPECIAL_VERSION_DESC=$LEAN_VERSION_STRING" fi