[992db6]: / scripts / asf-release.sh  Maximize  Restore  History

Download this file

140 lines (112 with data), 5.0 kB

  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
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
echo "This will prep a release, it'll make a local commit and tag but not push them. You should have PGP keys set up and ready"
function prompt() {
ivar="$1"
prompt_str="$2: "
default="$3"
if [[ -n "$default" ]]; then
prompt_str="$prompt_str[$default] "
fi
echo -n "$prompt_str"
read $ivar
eval $ivar=\${$ivar:-$default}
}
RELEASE_DIR_BASE=/tmp
PREV_VERSION=`git tag -l rel/* | sort -rV | head -1 | sed -e 's/^rel\///'`
VERSION=`echo $PREV_VERSION | perl -pe '@_ = split /\./; $_[-1]++; $_ = join ".", @_'`
prompt VERSION "Version" "$VERSION"
RELEASE_BASE=allura-$VERSION
RELEASE_DIR=$RELEASE_DIR_BASE/$RELEASE_BASE
RELEASE_FILENAME=$RELEASE_BASE.tar.gz
RELEASE_FILE_EXTRACTED=$RELEASE_DIR/$RELEASE_BASE
RELEASE_FILE=$RELEASE_DIR/$RELEASE_FILENAME
RELEASE_TAG=rel/$VERSION
CLOSE_DATE=`date -d '+72 hours' -R --utc | sed -e 's/+0000/UTC/'`
YEAR=`date +%Y`
sed -i -e "s/2012-[0-9]\{4\} /2012-$YEAR /" NOTICE */NOTICE */docs/conf.py
git commit -m "Update copyright year" NOTICE */NOTICE */docs/conf.py
scripts/changelog.py rel/$PREV_VERSION HEAD $VERSION > .changelog.tmp
echo >> .changelog.tmp
cat CHANGES >> .changelog.tmp
mv -f .changelog.tmp CHANGES
prompt DUMMY "CHANGES file populated, please edit it to summarize, write upgrade notes etc. Press enter when ready to commit" "enter"
git add CHANGES
git commit -m "CHANGES updated for ASF release $VERSION"
DEFAULT_KEY=`grep ^default-key ~/.gnupg/gpg.conf | sed -e 's/default-key //'`
if [[ -z "$DEFAULT_KEY" ]]; then
DEFAULT_KEY=`gpg --list-secret-keys | egrep '[0-9A-F]{8}' | head -1 | sed -e 's/\W//g'`
fi
prompt KEY "PGP Key to sign with" "$DEFAULT_KEY"
prompt RAT_LOG_PASTEBIN_URL "URL for RAT log pastebin (see scripts/src-license-check to create RAT report)"
git tag $RELEASE_TAG
COMMIT_SHA=`git rev-parse $RELEASE_TAG`
mkdir -p $RELEASE_DIR
git archive -o $RELEASE_FILE --prefix $RELEASE_BASE/ $RELEASE_TAG
# expand archive, run broccoli & sass in it, rebuild archive
cd $RELEASE_DIR
tar xzf $RELEASE_FILE
cd $RELEASE_FILE_EXTRACTED
npm install >/dev/null
NODE_ENV=production npm run build
NODE_ENV=production npm run css
rm -rf node_modules
cd ..
tar czf $RELEASE_FILE $RELEASE_BASE
rm -rf $RELEASE_FILE_EXTRACTED
gpg --default-key $KEY --armor --output $RELEASE_FILE.asc --detach-sig $RELEASE_FILE
SHA512_CHECKSUM=`cd $RELEASE_DIR ; shasum -a512 $RELEASE_FILENAME` ; echo "$SHA512_CHECKSUM" > $RELEASE_FILE.sha512
echo
echo
echo
echo "Release is ready at: $RELEASE_DIR"
echo "Once confirmed, push the CHANGES commit with:"
echo " git push"
echo "Then upload the files and signatures to https://dist.apache.org/repos/dist/dev/allura/ (SVN repo)"
echo "And post the following:"
echo "-------------------------------------------------------------"
echo "Subject: [VOTE] Release of Apache Allura $VERSION"
echo "-------------------------------------------------------------"
cat <<EOF
Hello,
This is a call for a vote on Apache Allura $VERSION.
Source tarball, signature and checksums are available at:
https://dist.apache.org/repos/dist/dev/allura/
Checksums:
SHA512: $SHA512_CHECKSUM
The KEYS file can be found at:
https://www.apache.org/dist/allura/KEYS
The release has been signed with key $KEY:
http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x$KEY
Source corresponding to this release can be found at:
Commit: $COMMIT_SHA
Tag: $RELEASE_TAG (pending successful vote)
Browse: https://forge-allura.apache.org/p/allura/git/ci/$COMMIT_SHA/log/
Changes for this version are listed at:
https://forge-allura.apache.org/p/allura/git/ci/$COMMIT_SHA/tree/CHANGES
The RAT license report is available at:
$RAT_LOG_PASTEBIN_URL
Vote will be open for at least 72 hours ($CLOSE_DATE). Votes from Allura PMC members are binding, but we welcome all community members to vote as well.
[ ] +1 approve
[ ] +0 no opinion
[ ] -1 disapprove (and reason why)
Thanks & Regards
EOF
echo "-------------------------------------------------------------"
echo "After a successful vote (just in case you have to redo the release), you can push the tag:"
echo " git push origin $RELEASE_TAG"