-
Notifications
You must be signed in to change notification settings - Fork 17
/
release_unstable_release_branch.sh
executable file
·36 lines (31 loc) · 1.92 KB
/
release_unstable_release_branch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o xtrace
if [ "$#" -ne 3 ]; then
echo "Illegal number of parameters, this script takes three parameters, version of the release, version of the next release on develop, and an OAuth token for GitHub"
fi
VERSION=$1
NEXT_VERSION=$2
TOKEN=$3
git tag $VERSION
git push --tags origin
mvn release:perform -DconnectionUrl=scm:git:[email protected]:SeqWare/seqware.git -Dtag=$VERSION
# upload non-jar artifacts to github
# create release
echo -e "{\"tag_name\":\""$VERSION"\", \"name\":\""$VERSION"\", \"prerelease\": true, \"body\":\""Automated release message"\"}" > release.json
curl -u $TOKEN:x-oauth-basic -X POST -d @release.json https://api.github.com/repos/SeqWare/seqware/releases?tag_name=$VERSION&name=$VERSION
rm release.json
# extract release number, relies upon order of releases which can be improved
GITHUB_RELEASE_NUMBER=`curl -i https://api.github.com/repos/SeqWare/seqware/releases | grep \"id\" | head -n1 | cut -d':' -f2 | cut -d',' -f1 | tr -d ' '`
curl -u $TOKEN:x-oauth-basic -X POST --data-binary @seqware-pipeline/target/seqware https://uploads.github.com/repos/SeqWare/seqware/releases/$GITHUB_RELEASE_NUMBER/assets?name=seqware --header "Content-Type:text/plain"
curl -u $TOKEN:x-oauth-basic -X POST --data-binary @seqware-pipeline/target/archetype-catalog.xml https://uploads.github.com/repos/SeqWare/seqware/releases/$GITHUB_RELEASE_NUMBER/assets?name=archetype-catalog.xml --header "Content-Type:text/xml"
# if the following dies with a merge error, run git mergetool -t kdiff3
git checkout develop
git merge release/$VERSION
mvn versions:set -DnewVersion=$NEXT_VERSION-SNAPSHOT
find . -name "pom.xml" -type f -exec sed -i "s/<seqware-version>$VERSION<\/seqware-version>/<seqware-version>$NEXT_VERSION-SNAPSHOT<\/seqware-version>/g" {} \;
git add pom.xml \*/pom.xml
git commit -m "Iterate version numbers to $NEXT_VERSION"
git push
git push origin --delete release/$VERSION