forked from wsdl2phpgenerator/wsdl2phpgenerator
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
91 lines (74 loc) · 4.59 KB
/
build.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="wsdl2phpgenerator" default="prepare-release">
<target name="prepare-release" depends="check-prerequisites, update-changelog"
description="Prepare a release by performing all related changes to the code base.">
<echo>Current code changes for release ${version}</echo>
<exec command="git diff HEAD" passthru="true" />
<echo>Make last adjustments by hand and use vendor/bin/phing create-release to finalize it.</echo>
</target>
<target name="create-release" depends="check-prerequisites, init-github"
description="Finalize a release by committing, tagging and pushing changes, creating a release, and upload phar file as an asset.">
<echo>Committing and tagging release ${version}</echo>
<!-- Extract a list of changes from the added lines to the changelog. These line will be prefixed by "+ *".
Drop the + but keep the *. -->
<exec command="git diff -U0 CHANGES > TAG_MESSAGE" />
<reflexive file="TAG_MESSAGE">
<filterchain>
<linecontainsregexp>
<regexp pattern="^\+\s\*\s" ignoreCase="true" />
</linecontainsregexp>
<replaceregexp>
<regexp pattern="\+\s" replace="" />
</replaceregexp>
</filterchain>
</reflexive>
<loadfile file="TAG_MESSAGE" property="changes"/>
<delete file="TAG_MESSAGE" />
<!-- Add, commit, tag and push changes. The tag message makes a nice release note on GitHub. -->
<exec command="git add README.md CHANGES" logoutput="true" checkreturn="true" />
<exec command="git commit -m 'Release ${version}'" logoutput="true" checkreturn="true" />
<exec command="git tag ${version} -f -m 'Release ${version}${line.separator}${changes}'" />
<exec command="git push origin master ${version}" logoutput="true" checkreturn="true" />
<!-- Create a proper release for the tag as tags cannot have assets attached. -->
<githubcreaterelease username="${username}" password="${password}" authMethod="password"
owner="wsdl2phpgenerator" repository="wsdl2phpgenerator" tagName="${version}"
releaseId="release" />
</target>
<target name="update-changelog" depends="check-prerequisites"
description="Update the changelog with changes for a version.">
<!-- Reset any changes made to the changelog. -->
<exec command="git checkout CHANGES" />
<!-- Rebuild the changelog using git-changelog- -->
<exec command="git changelog --tag ${version}" />
<!-- Remove merge commits from changelog. They are of little relevance here. -->
<reflexive>
<fileset dir=".">
<filename name="CHANGES"/>
</fileset>
<filterchain>
<linecontainsregexp>
<regexp pattern="^((?!\* merge).)*$" ignoreCase="true" />
</linecontainsregexp>
</filterchain>
</reflexive>
</target>
<target name="check-prerequisites" description="Check that all required elements are available." hidden="true">
<propertyprompt propertyName="version" useExistingValue="true"
promptText="Enter the verson/git tag to work with" />
<!-- To detect whether git-changelog is available try checking the help section for the command. -->
<exec command="git help changelog" outputProperty="git.changelog"/>
<condition property="git.changelog.missing" value="true">
<contains string="${git.changelog}" substring="no manual entry" casesensitive="false"/>
</condition>
<fail if="git.changelog.missing" message="git changelog must be installed to create a release. See https://github.com/visionmedia/git-extras."/>
<echo>git changelog: OK</echo>
</target>
<target name="init-github" description="Initialize GitHub tasks and properties" hidden="true">
<!-- Load GitHub tasks. -->
<taskdef name="githubcreaterelease" classname="PhingGitHub\CreateReleaseTask" classpath="vendor/kasperg" />
<taskdef name="githubcreateassets" classname="PhingGitHub\CreateAssetsTask" classpath="vendor/kasperg" />
<!-- Initialize GitHub-related properties -->
<propertyprompt promptText="Enter your GitHub username?" propertyName="username" useExistingValue="true"/>
<propertyprompt promptText="Enter your GitHub password?" propertyName="password" useExistingValue="true"/>
</target>
</project>