Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 19 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
name: Run tests

on: [pull_request]
on: [ pull_request ]

jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.7
uses: actions/setup-java@v1
with:
java-version: 1.7
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Test
run: mvn clean install -DskipTests=false --update-snapshots -q
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: temurin
- name: Test
run: mvn clean install -DskipTests=false --update-snapshots -q

artifact:
name: Publish - Nexus
runs-on: ubuntu-latest
needs: unit-test

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 11.0.4
java-version: 11
distribution: temurin

- name: Release Maven package
uses: samuelmeuli/action-maven-publish@v1
with:
nexus_username: ${{ secrets.nexus_username }}
nexus_password: ${{ secrets.nexus_password }}
maven_profiles: "branch"
env:
SONATYPE_PORTAL_USERNAME: ${{ secrets.SONATYPE_PORTAL_USERNAME }}
SONATYPE_PORTAL_PASSWORD: ${{ secrets.SONATYPE_PORTAL_PASSWORD }}
run: |
mvn clean deploy --settings .mvn/settings.xml -Dmaven.test.skip=true -B
40 changes: 20 additions & 20 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@ jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.7
uses: actions/setup-java@v1
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: 1.7
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
java-version: 11
distribution: temurin
- name: Test
run: mvn clean install -DskipTests=false --update-snapshots -q

Expand All @@ -29,18 +24,23 @@ jobs:
needs: unit-test

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 11.0.4
java-version: 11
distribution: temurin

- name: Remove snapshot
run: mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false

- name: Release Maven package
uses: samuelmeuli/action-maven-publish@v1
with:
nexus_username: ${{ secrets.nexus_username }}
nexus_password: ${{ secrets.nexus_password }}
gpg_private_key: ${{ secrets.PGP_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.PGP_PASSPHRASE }}
maven_profiles: "master"
env:
SONATYPE_PORTAL_USERNAME: ${{ secrets.SONATYPE_PORTAL_USERNAME }}
SONATYPE_PORTAL_PASSWORD: ${{ secrets.SONATYPE_PORTAL_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
GPG_SECRET_KEYS: ${{ secrets.PGP_PRIVATE_KEY }}
run: |
echo -e "$GPG_SECRET_KEYS" | gpg --import --no-tty --batch --yes
mvn clean deploy --settings .mvn/settings.xml -Dgpg.skip=false -Dmaven.test.skip=true -B

26 changes: 26 additions & 0 deletions .mvn/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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">

<servers>
<server>
<id>central</id>
<username>${env.SONATYPE_PORTAL_USERNAME}</username>
<password>${env.SONATYPE_PORTAL_PASSWORD}</password>
</server>
</servers>

<profiles>
<profile>
<id>central</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
128 changes: 32 additions & 96 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<packaging>jar</packaging>
<name>DHIS Antlr Expression Parser</name>
<groupId>org.hisp.dhis.parser</groupId>
<version>1.0.36</version>
<version>1.0.37-SNAPSHOT</version>

<description>Antlr Expression Parser</description>

Expand Down Expand Up @@ -88,6 +88,7 @@
<antlr4.visitor>true</antlr4.visitor>
<antlr4.listener>true</antlr4.listener>
<antlr.version>4.9.3</antlr.version>
<gpg.skip>true</gpg.skip>
</properties>


Expand All @@ -100,94 +101,6 @@
</activeByDefault>
</activation>
</profile>
<profile>
<id>branch</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-no-releases</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireSnapshotVersion>
<message>No Releases Allowed!</message>
</requireSnapshotVersion>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>master</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-no-snapshots</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireReleaseVersion>
<message>No Snapshots Allowed!</message>
</requireReleaseVersion>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<!-- Prevent `gpg` from using pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
Expand Down Expand Up @@ -239,13 +152,36 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.8.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
<deploymentName>DHIS2 ANTLR Expression Parser</deploymentName>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<name>Sonatype OSS</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>