-
Notifications
You must be signed in to change notification settings - Fork 39
/
release
executable file
·71 lines (53 loc) · 2.1 KB
/
release
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
#!/bin/bash
VERSION="$1"
echo "Preparing to release MESA version ${VERSION}"
if [[ ! -n ${VERSION} ]]; then
echo "Error: Please specify version number. E.g. r2X.YY.Z or r2X.YY.Z-rcA"
exit 1
fi
if [[ ! ${VERSION} == r* ]]; then
echo "Error: Version number must start with 'r'. E.g. r2X.YY.Z or r2X.YY.Z-rcA"
exit 1
fi
# check that the changelog has been updated
if ! grep -q "Changes in ${VERSION}" docs/source/changelog.rst; then
echo "Error: Please update the changelog by moving 'Changes in main' to a new section called 'Changes in ${VERSION}' and add a new 'Changes in main' section at the top of the file following 'changelog_template.rst'. Make sure this change is commited in the 'main' development branch of MESA."
exit 1
fi
# strip the r and hypen from version number to create a PEP440 standard tag
TAG=${VERSION:1}
TAG=${TAG//-}
echo "The associated (PEP440) tag version ${VERSION} is: ${TAG}"
cd ${MESA_DIR} || exit 1
# Do the work in a seperate branch
git checkout -b release/${VERSION}
# Add version_number file
echo ${VERSION} > data/version_number
git add -f data/version_number
# Update dox
sed -i "s/PROJECT_NUMBER\ \ \ .*/PROJECT_NUMBER\ \ \ \ \ \ \ \ \ =\ ${VERSION}/" Doxyfile
git add Doxyfile
# Update docs/source/conf.py
sed -i 's/release\ =.*/release\ =\ '"'${TAG}'"'/' docs/source/conf.py
sed -i 's/version\ =.*/version\ =\ '"'${TAG}'"'/' docs/source/conf.py
git add docs/source/conf.py
# Update docs/source/changelog.rst
PATTERN1="This section describes changes present in the development"
PATTERN2="Before releasing a new version of MESA"
if grep -q "$PATTERN1" docs/source/changelog.rst; then
if grep -q "$PATTERN2" docs/source/changelog.rst; then
sed -i "/$PATTERN1/,/$PATTERN2/d" docs/source/changelog.rst
fi
fi
git add docs/source/changelog.rst
# Commit and tag the changes
git commit -a -m "Release: ${VERSION}"
git tag ${TAG}
# Make the archive
git archive --prefix=mesa-${VERSION}/ --format=zip ${TAG} > mesa-${VERSION}.zip
echo "Now check the archive builds before pushing the changes"
exit 0
# Cleanup when testing
git checkout main
git tag -d ${TAG}
git branch -D release/${VERSION}