Skip to content

Commit

Permalink
add maven deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Jun 20, 2024
1 parent b7c0886 commit 477188c
Show file tree
Hide file tree
Showing 8 changed files with 344 additions and 70 deletions.
43 changes: 41 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ jobs:
with:
path: ~/work/_actions/lucee/script-runner/main/lucee-download-cache
key: lucee-downloads
- name: Build extension-s3 with Ant
run: ant -noinput -verbose -buildfile build.xml
- name: Build and Install with Maven
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
echo "------- Maven Install -------";
mvn -B -e -f pom.xml clean install
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -76,3 +82,36 @@ jobs:
S3_GOOGLE_SECRET_KEY: ${{ secrets.S3_GOOGLE_SECRET_KEY }}
S3_GOOGLE_HOST: storage.googleapis.com
S3_GOOGLE_BUCKET_PREFIX: lucee-ldev-e-
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Extract version number
id: extract-version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Import GPG key
run: |
echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}

- name: Build and Deploy with Maven
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
if [[ "$VERSION" == *-SNAPSHOT ]]; then
echo "------- Maven Deploy snapshot on ${{ github.event_name }} -------";
mvn -B -e -f pom.xml clean deploy --settings maven-settings.xml
else
echo "------- Maven Deploy release on ${{ github.event_name }} -------";
mvn -B -e -f pom.xml clean deploy -DperformRelease=true --settings maven-settings.xml
fi
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/dist
/target
**/Test.java
**/TestCase.java
**/.DS_Store
Expand Down
3 changes: 0 additions & 3 deletions build.number

This file was deleted.

10 changes: 0 additions & 10 deletions build.properties

This file was deleted.

75 changes: 22 additions & 53 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,43 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="clean" basedir="." name="formtag-extension">
<project default="clean" basedir="." name="s3-extension">
<description>
Build Form Extension
Build S3 Extension
</description>
<!-- set global properties for this build -->

<property file="build.properties"/>

<property name="lib" location="source/java/libs"/>
<property name="src" location="source/java/src"/>
<property name="srcImg" location="source/images"/>
<property name="temp" location="temp"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property name="dist" location="target"/>

<property name="tld" location="source/tld"/>
<property name="fld" location="source/fld"/>



<buildnumber file="build.number"/>

<scriptdef name="replace" language="javascript">
<attribute name="haystack" />
<attribute name="needle" />
<attribute name="repl" />
<attribute name="property" />
<![CDATA[
var text = attributes.get("haystack");
var needle = attributes.get("needle");
var repl = attributes.get("repl");
text=text.trim();
var regex = new RegExp(needle,'g');
text=text.replace(regex,repl);
project.setProperty(attributes.get("property"), text);
]]>
</scriptdef>

<path id="classpath">
<fileset dir="${lib}">
<include name="**/*.jar" />
Expand Down Expand Up @@ -77,14 +55,14 @@

<echo file="${dist}/extension/META-INF/MANIFEST.MF">Manifest-Version: 1.0
Built-Date: ${NOW}
version: "${bundleversion}${build.number}${appendix}"
version: "${bundleversion}"
id: "${id}"
name: "${label}"
description: "${description}"
lucee-core-version: "${luceeCoreVersion}"
release-type: ${releaseType}
start-bundles: false
resource: "[{'class':'${class}','bundleName':'${bundlename}','bundleVersion':'${bundleversion}${build.number}${appendix}','scheme':'s3','lock-timeout':'10000'}]"
resource: "[{'class':'${class}','bundleName':'${bundlename}','bundleVersion':'${bundleversion}','scheme':'s3','lock-timeout':'10000'}]"
</echo>
</target>

Expand All @@ -104,38 +82,28 @@ resource: "[{'class':'${class}','bundleName':'${bundlename}','bundleVersion':'${

<!-- Put everything in ${build} into .jar file -->
<jar
jarfile="${dist}/extension/jars/${filename}-${bundleversion}${build.number}${appendix}.jar" basedir="${build}" manifest="${src}/META-INF/MANIFEST.MF">
jarfile="${dist}/extension/jars/${bundlename}-${bundleversion}.jar" basedir="${build}" manifest="${src}/META-INF/MANIFEST.MF">
<manifest>
<attribute name="Bundle-Version" value="${bundleversion}${build.number}${appendix}"/>
<attribute name="Bundle-Version" value="${bundleversion}"/>
<attribute name="Built-Date" value="${NOW}"/>
<attribute name="Bundle-SymbolicName" value="${bundlename}"/>

</manifest>
</jar>



<!-- copy the tlds necessary
<loadfile property="content1" srcFile="${tld}/tag.tld" />
<replace haystack="${content1}" needle="{bundle-name}" repl="${bundlename}" property="content2"/>
<replace haystack="${content2}" needle="{bundle-version}" repl="${bundleversion}${build.number}${appendix}" property="content3"/>
<echo message="${content3}" file="${dist}/extension/tlds/pdftag.tld"/>
-->

<!-- copy the flds necessary -->
<loadfile property="c1" srcFile="${fld}/function.fld" />
<replace haystack="${c1}" needle="{bundle-name}" repl="${bundlename}" property="c2"/>
<replace haystack="${c2}" needle="{bundle-version}" repl="${bundleversion}${build.number}${appendix}" property="c3"/>
<echo message="${c3}" file="${dist}/extension/flds/s3-functions.fld"/>



<!-- copy the context necessary
<copy todir="${dist}/extension/webcontexts">
<fileset dir="${context}">
<include name="**/*.*"/>
</fileset>
</copy> -->
<copy file="${fld}/function.fld" tofile="${dist}/extension/flds/s3-functions.fld" />
<replaceregexp
file="${dist}/extension/flds/s3-functions.fld"
match="\{bundle-name\}"
replace="${bundlename}"
byline="true"/>
<replaceregexp
file="${dist}/extension/flds/s3-functions.fld"
match="\{bundle-version\}"
replace="${bundleversion}"
byline="true"/>

<!-- copy the jars necessary -->
<copy todir="${dist}/extension/jars">
Expand Down Expand Up @@ -166,16 +134,17 @@ resource: "[{'class':'${class}','bundleName':'${bundlename}','bundleVersion':'${


<!-- Zip everything -->
<zip destfile="${dist}/${filename}-${bundleversion}${build.number}${appendix}.lex">
<zip destfile="${dist}/${filename}-${bundleversion}.lex">
<zipfileset dir="${dist}/extension"/>
</zip>

</target>

<target name="clean" depends="dist" description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${temp}"/>
<delete dir="${dist}/extension"/>
<delete dir="${build}"/>
<delete dir="${temp}"/>
</target>

</project>
27 changes: 27 additions & 0 deletions maven-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups></pluginGroups>
<proxies></proxies>
<servers>
<server>
<id>ossrh</id>
<username>${env.MAVEN_USERNAME}</username>
<password>${env.MAVEN_PASSWORD}</password>
</server>
</servers>
<mirrors></mirrors>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg2</gpg.executable>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
Loading

0 comments on commit 477188c

Please sign in to comment.