aboutsummaryrefslogtreecommitdiffstats
path: root/dist/release-vespa-rpm.sh
blob: e19484b63c99c525fc2b6643fc771f956f4cb692 (plain) (blame)
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
#!/bin/bash
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

set -e

if [[ $# -ne 2 ]]; then
  echo "Usage: $0 <version> <git ref>"
  exit 1
fi

if [[ -z $COPR_WEBHOOK ]]; then
    echo "This script requires the COPR_WEBHOOK environment variable to be set."
    exit 1
fi

readonly VERSION=$1
readonly GITREF=$2
readonly RELEASE_TAG="v$VERSION"
readonly CURRENT_BRANCH=$(git branch | grep "^\*" | cut -d' ' -f2)

# Make sure we are up to date
git checkout master
git pull --rebase

# Create a proper release tag

git tag -a "$RELEASE_TAG" -m "Release version $VERSION" $GITREF
git push origin "$RELEASE_TAG"

git reset --hard HEAD
git checkout $CURRENT_BRANCH