-
Notifications
You must be signed in to change notification settings - Fork 15
/
build-release.ps1
63 lines (43 loc) · 1.91 KB
/
build-release.ps1
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
# This script assumes that the 'release' branch is actually ready for release.
# That includes merging in all relevant changes for the release (in particular
# the 'development' branch), and adding a new entry to CHANGELOG.txt. The latter
# is very important as the target version will be read from that file.
# You do NOT need to build the documentation yet. This script takes care of
# that.
# Note that this script does NOT merge the updated 'release' branch back into
# 'development'. If you need the documentation, CHANGELOG or other commits on
# 'release' in 'development', you'll need to do that extra merge manually.
# We recommend that you use git's credential cache or an SSH agent so you don't
# have to enter your credentials several times during the script.
################################################################################
# Make the project root directory the working directory (regardless of where the
# script has been called from).
$scriptPath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptPath
Push-Location $dir
# Read current branch
$branch = git status | Select-String -Pattern "On branch (.*)" -List `
| %{$_.matches[0].groups[1].value}
git checkout release
# Read version
$version = Select-String -Pattern "Version\s+([\d\w.-]+)" -List .\CHANGELOG.txt `
| %{$_.matches[0].groups[1].value}
# Build and commit documentation
phpdoc -d src/FACTFinder -t docs --template clean --sourcecode
git add --all docs
git commit -m "Update documentation for release $version"
git push origin release
# Prepare and push master branch
git checkout master
git merge --no-ff --log release
git push origin master
# Prepare and push src-only branch
git subtree split --prefix=src --onto=src-only --branch=src-only
git push origin src-only
# Create release tags
git tag $version
git tag $version+src src-only
git push --tags origin
# Move back to original branch
git checkout $branch
Pop-Location