Skip to content

Commit

Permalink
Remove some double ups and add version next default at a point that u…
Browse files Browse the repository at this point in the history
…nless it is declared on command line the release fails.
  • Loading branch information
Narimm committed Jun 6, 2023
1 parent 7be37b3 commit bd3dd74
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Checkout Tags
run: git fetch --tags origin
- name: Build with Ant
run: ant -noinput -Dbuild.number=$GITHUB_RUN_NUMBER default
run: ant -noinput -Dbuild.number=$GITHUB_RUN_NUMBER -Drelease=true -DdryRun=true release
- name: Release Artifacts
uses: xresloader/upload-to-github-release@v1
env:
Expand Down
68 changes: 27 additions & 41 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,19 @@
<property name="test.php.src" location="${src.dir}/test/php"/>
<property name="resources.src" location="${src.dir}/main/resources"/>
<property name="build.number" value="local"/>
<condition property="version.current" value="HEAD">
<not>
<isset property="release"/>
</not>
</condition>
<condition property="version.current" value="${plugin.version}">
<condition property="version.current" value="${plugin.version}" else="HEAD">
<isset property="release"/>
</condition>
<condition property="plugin.build_version" value="${plugin.version}-beta">
<not>
<isset property="release"/>
</not>
</condition>
<condition property="plugin.build_version" value="${plugin.version}">
<isset property="release"/>
</condition>
<condition property="plugin.stable_version" value="${version.prior}">
<not>
<isset property="release"/>
</not>
<condition property="plugin.build_version" value="${plugin.version}" else="${plugin.version}-beta">
<isset property="release"/>
</condition>
<condition property="plugin.stable_version" value="${plugin.version}">
<condition property="plugin.stable_version" value="${plugin.version}" else="${version.prior}">
<isset property="release"/>
</condition>
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd hh:mm"/>
</tstamp>
<fail unless="plugin.name"/>
<fail unless="plugin.name" message="Plugin Name missing"/>
<filterset id="slm_replacement">
<filter token="build.date" value="${TODAY}"/>
<propertyset>
Expand Down Expand Up @@ -92,11 +77,18 @@
</copy>
</target>
<target name="info.generate" depends="make.dir" unless="publish">
<property name="git_arg" value='log --pretty=format:"* %s (%an)" ${version.prior}..${version.current}'/>
<condition property="git_arg" value='log --pretty=format:"* %s (%an)" ${version.prior}..${version.current}'
else='log --pretty=format:"* %s (%an)" ${version.prior}..HEAD' >
<and>
<isset property="release"/>
<not>
<isset property="dryRun" />
</not>
</and>
</condition>
<exec executable="git" failonerror="true" outputproperty="git.changelog" logerror="true" resolveexecutable="true">
<arg line='${git_arg}'/>
</exec>
<delete file="${build.dir}\${plugin.slug}\CHANGELOG"/>
<concat destfile="${build.dir}\${plugin.slug}\CHANGELOG" fixlastline="true">
<header trimleading="yes">${TODAY} - v${version.prior} .. v${version.current}
${git.changelog}
Expand Down Expand Up @@ -127,12 +119,20 @@
basedir="/${build.dir}"
/>
</target>
<target name="release.init" >
<property name="release" value="true"/>
<target name="release.init">
<fail unless="version.next"/>
<echo message="Current Release version is: ${version.current}"/>
</target>
<target name="release.tag" if="release">
<target name="release.update" if="release" depends="release.commit">
<delete file="CHANGELOG"/>
<copy file="${build.dir}\${plugin.slug}\CHANGELOG" tofile="CHANGELOG"/>
<propertyfile file="build.properties">
<entry key="version.prior" value="${version.current}" operation="="/>
<entry key="plugin.version" value="${version.next}" operation="="/>
</propertyfile>
</target>
<target name="release.commit" if="release" unless="dryRun">
<property name="release-commit-message" value="Release Version ${plugin.version}"/>
<echo message="Creating Branch and Tagging for release"/>
<git command="branch">
<args>
Expand All @@ -149,19 +149,6 @@
<arg value="${plugin.version}"/>
</args>
</git>
</target>
<target name="release.update" if="release" depends="release.tag,info.generate">
<delete file="CHANGELOG"/>
<move file="${build.dir}\${plugin.slug}\CHANGELOG" tofile="CHANGELOG"/>
</target>
<target name="build.properties.update" if="release" depends="release.update">
<propertyfile file="build.properties">
<entry key="version.prior" value="${version.current}" operation="="/>
<entry key="plugin.version" value="${version.next}" operation="="/>
</propertyfile>
</target>
<target name="release.commit" if="release">
<property name="release-commit-message" value="Release Version ${plugin.version}"/>
<git command="commit">
<args>
<arg value="-am ${release-commit-message}" />
Expand All @@ -173,9 +160,8 @@
</args>
</git>
</target>
<target name="release.finalize" if="release">
<target name="release.finalize" if="release" unless="dryRun">
<property name="master-commit-message" value="Prepare Development branch for ${version.next}"/>

<git command="commit">
<args>
<arg value="-am ${master-commit-message}"/>
Expand All @@ -185,6 +171,6 @@
<target name="default" depends="make.dir, make, info.generate, zip">
<echo message="Build Version ${plugin.version} Complete find the zip in ${dist.dir}/${plugin.slug}.zip" level="info"/>
</target>
<target name="release" depends="release.init,default, release.commit, release.tag, build.properties.update,release.finalize" />
<target name="release" depends="release.init,default, release.commit, release.update,release.finalize" />
</project>

0 comments on commit bd3dd74

Please sign in to comment.