Skip to content

Commit

Permalink
Merge pull request #35 from directwebremoting/pipeline-changes-per-mike
Browse files Browse the repository at this point in the history
Pipeline changes per Mike's suggestions
  • Loading branch information
dmarginian committed May 23, 2020
2 parents 9f55767 + d542039 commit c1d9375
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 41 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Development CI

on: [push]

jobs:
build-and-oss-deploy:
jobs:
build:
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -31,21 +31,24 @@ jobs:
with:
path: 'core/impl/main/java/dwr-version.properties'
property: 'revision'
- name: Read DWR title
id: read_dwr_title
uses: christian-draeger/[email protected]
with:
path: 'core/impl/main/java/dwr-version.properties'
property: 'title'
- name: Set up Maven OSS Repository
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish to Maven OSS
run: mvn deploy:deploy-file -DgeneratePom=false -DrepositoryId=ossrh -Durl=https://oss.sonatype.org/content/repositories/snapshots/ -Dfile=dist/lib/dwr-${{env.DWR_VERSION}}.jar -Dtype=jar -DartifactId=dwr -DpomFile=pom.xml -Dpackaging=jar -Djavadoc=dist/lib/dwr-${{env.DWR_VERSION}}-javadoc.jar -Dsources=dist/lib/dwr-${{env.DWR_VERSION}}-sources.jar -Dfiles=dist/lib/dwr-${{env.DWR_VERSION}}-jdk14.jar -Dclassifiers=jdk14 -Dtypes=jar
- name: Publish to Maven OSS
if: ${{steps.read_dwr_title.outputs.value}} == "SNAPSHOT"
run: mvn deploy:deploy-file -DgeneratePom=false -DrepositoryId=ossrh -Durl=https://oss.sonatype.org/content/repositories/snapshots/ -Dfile=dist/lib/dwr-${{env.DWR_VERSION}}.jar -Dtype=jar -DartifactId=dwr -DpomFile=target/pom.xml -Dpackaging=jar -Djavadoc=dist/lib/dwr-${{env.DWR_VERSION}}-javadoc.jar -Dsources=dist/lib/dwr-${{env.DWR_VERSION}}-sources.jar -Dfiles=dist/lib/dwr-${{env.DWR_VERSION}}-jdk14.jar -Dclassifiers=jdk14 -Dtypes=jar
env:
MAVEN_USERNAME: ${{secrets.MAVEN_USERNAME}}
MAVEN_PASSWORD: ${{secrets.MAVEN_PASSWORD}}
DWR_VERSION: ${{steps.read_dwr_major.outputs.value}}.${{steps.read_dwr_minor.outputs.value}}.${{steps.read_dwr_revision.outputs.value}}
deploy-release:
if: contains(github.ref, "release")
runs-on: ubuntu-16.04
steps:
- run: echo "I only run if the branch has release in its name!"
DWR_VERSION: ${{steps.read_dwr_major.outputs.value}}.${{steps.read_dwr_minor.outputs.value}}.${{steps.read_dwr_revision.outputs.value}}-${{steps.read_dwr_title.outputs.value}}

44 changes: 16 additions & 28 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,14 @@
<!-- File that contains local settings, you may need to edit this -->
<property file="build.properties" />

<!-- environment used during CI -->
<property environment="env"/>

<!-- Properties for Maven Deploy, Stage, Release
See: https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-7c.DeploySnapshotsandStageReleaseswithAnt
-->
<property name="dist" location="dist" />

<!-- Version numbers: Duplicates the logic in VersionUtil.loadProperties() -->
<property file="${source.root}/core/impl/main/java/dwr-version.properties" />
<property name="version" value="${major}.${minor}.${revision}" />
<property name="env.DWR_VERSION" value="${version}"/>
<condition property="label" value="${version}">
<equals arg1="${title}" arg2="" />
</condition>
<condition property="label" value="${version}.${title}">
<not>
<equals arg1="${title}" arg2="" />
</not>
</condition>
<property name="version" value="${major}.${minor}.${revision}-${title}" />

<!-- define Maven coordinates -->
<property name="groupId" value="org.directwebremoting" />
Expand All @@ -39,6 +27,12 @@
<property name="dwr-maven-jdk14-jar" value="${dist}/lib/${artifactId}-${version}-jdk14.jar" />
<!-- End Properties for Maven -->

<!-- Get build number from Github CI -->
<property environment="envgithub"/>
<condition property="build.number" value="${envgithub.GITHUB_RUN_ID}">
<isset property="envgithub.GITHUB_RUN_ID" />
</condition>

<target name="init">
<mkdir dir="${build}" />
<mkdir dir="${dist}/lib" />
Expand Down Expand Up @@ -83,21 +77,17 @@

<!-- Updates the pom.xml with the version -->
<target name="setVersionInPom">
<if>
<isset property="env.GITHUB_RUN_ID" />
<then>
<replace casesensitive="false" file="pom.xml" token="{version}" value="${version}" />
</then>
</if>
<copy file="build/pom.xml" todir="target"/>
<replace casesensitive="false" file="target/pom.xml" token="{version}" value="${version}" />
</target>

<!-- Updates the build number in dwr-version.properties with the build number from CI -->
<target name="setBuildNumber" description="Update dwr-version.properties with CI build number.">
<target name="updateVersionPropertiesWithBuildNumber" description="Update dwr-version.properties with CI build number.">
<if>
<isset property="env.GITHUB_RUN_ID" />
<isset property="build.number" />
<then>
<propertyfile file="${target.root}/classes/main/dwr-version.properties">
<entry key="build.number" value="${env.GITHUB_RUN_ID}" />
<entry key="build.number" value="${build.number}" />
</propertyfile>
</then>
</if>
Expand All @@ -106,10 +96,8 @@
<!--=======================================================================-->
<target name="jar" depends="prepare, source" description="Create dwr.jar">
<build target="${target.root}" include="" modules="${modules}" />
<!-- Set the version in the pom if a CI run -->
<antcall target="setVersionInPom" />
<!-- Set the build number if a CI run -->
<antcall target="setBuildNumber" />
<antcall target="updateVersionPropertiesWithBuildNumber" />
<jar destfile="${target.root}/dwr.jar" compress="true">
<fileset dir="${target.root}/classes/main" />
</jar>
Expand Down Expand Up @@ -137,7 +125,7 @@
</target>

<!--=======================================================================-->
<target name="package" depends="war" description="Create packaged outputs: dwrdemo.war, dwr-jdk14.jar, and the source .zip">
<target name="package" depends="war, updateVersionPropertiesWithBuildNumber" description="Create packaged outputs: dwrdemo.war, dwr-jdk14.jar, and the source .zip">
<!-- Run retroweaver if dwr.jar has changed since we last ran it -->
<taskdef name="retroweaver" classname="net.sourceforge.retroweaver.ant.RetroWeaverTask">
<classpath>
Expand Down Expand Up @@ -174,7 +162,7 @@
</if>
<!-- Documentation: Javadoc and DTDDoc -->
<mkdir dir="${target.root}/javadoc" />
<javadoc access="public" author="true" destdir="${target.root}/javadoc" doctitle="DWR Version ${label}" use="true" splitindex="true" version="true">
<javadoc access="public" author="true" destdir="${target.root}/javadoc" doctitle="DWR Version ${version}" use="true" splitindex="true" version="true">
<sourcepath>
<pathelement path="${source.root}/core/api/main/java" />
<pathelement path="${source.root}/core/impl/main/java" />
Expand Down Expand Up @@ -210,7 +198,7 @@
<exclude name="common/*.dtd" />
</DTDDoc>
<!-- Source package -->
<zip destfile="${target.root}/dwr-${label}-src.zip">
<zip destfile="${target.root}/dwr-${version}-src.zip">
<fileset dir="${source.root}">
<exclude name="target/**" />
<exclude name="**/*.iml" />
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions core/impl/main/java/dwr-version.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
major=3
minor=0
revision=3-SNAPSHOT
title=dev
build.number=
revision=3
title=SNAPSHOT
# build.number property is added by CI builds

0 comments on commit c1d9375

Please sign in to comment.