Skip to content

Commit

Permalink
Repo fix and CI integration
Browse files Browse the repository at this point in the history
  • Loading branch information
pmanko committed Dec 11, 2020
1 parent 89f44ad commit 4f9448a
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 8 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 8.0.232
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- uses: s4u/[email protected]
with:
servers: |
[{
"id": "github-packages",
"username": "${{ secrets.RELEASE_USERNAME }}",
"password": "${{ secrets.RELEASE_TOKEN }}"
}]
githubServer: false
- name: Build with Maven
run: mvn -P 'github-packages' -B install
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish package to GitHub Packages
on:
release:
types: [created]
push:
branches: [master]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8.0.232
server-id: github-packages # Value of the distributionManagement/repository/id field of the pom.xml
server-username: pmanko
server-password: ${{ secrets.TOKEN }} # env variable for token in deploy
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- uses: s4u/[email protected]
with:
servers: |
[{
"id": "github-packages",
"username": "${{ secrets.RELEASE_USERNAME }}",
"password": "${{ secrets.RELEASE_TOKEN }}"
}]
githubServer: false
- name: Build
run: mvn -P github-packages -DskipTests -Dfindbugs.skip=true -Dpmd.skip=true -Dcpd.skip=true -B package
- name: Publish package
run: mvn -P github-packages -DskipTests -Dfindbugs.skip=true -Dpmd.skip=true -Dcpd.skip=true -B deploy
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>xds-sender</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>

<artifactId>xds-sender-api</artifactId>
Expand Down
35 changes: 33 additions & 2 deletions omod/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>xds-sender</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>

<artifactId>xds-sender-omod</artifactId>
Expand Down Expand Up @@ -50,5 +50,36 @@
</testResource>
</testResources>
</build>

<profiles>
<profile>
<id>github-packages</id>
<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<executions>
<execution>
<!-- Deploy OpenMRS omod file -->
<id>deploy-file</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<url>https://maven.pkg.github.com/isanteplus/isanteplus-packages</url>
<file>target/${project.parent.artifactId}-${project.version}.omod</file>
<repositoryId>github-packages</repositoryId>
<packaging>omod</packaging>
<generatePom>false</generatePom>
<artifactId>${project.parent.artifactId}</artifactId>
<version>${project.version}</version>
<groupId>${groupId}</groupId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
67 changes: 62 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>org.openmrs.module</groupId>
<artifactId>xds-sender</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<packaging>pom</packaging>
<name>XDS Sender</name>
<description>Module for sending XDS.b documents for encounters</description>
Expand Down Expand Up @@ -204,13 +204,13 @@
<repository>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>http://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
<url>https://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
</repository>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>dcm4che</id>
Expand All @@ -220,16 +220,73 @@
<id>marc-te-main</id>
<url>http://te.marc-hi.ca/mvn</url>
</repository>
<repository>
<id>santesute-main</id>
<url>http://santesuite.org/mvn</url>
<name>SanteSuite</name>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>http://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
<url>https://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

<profiles>
<profile>
<!-- Github Packages Integration -->
<id>github-packages</id>
<distributionManagement>
<!-- Deploy to Github Packages -->
<repository>
<id>github-packages</id>
<name>Github iSantePlus Packages</name>
<url>https://maven.pkg.github.com/isanteplus/isanteplus-packages</url>
<uniqueVersion>false</uniqueVersion>
</repository>
<snapshotRepository>
<id>github-packages</id>
<name>Github iSantePlus Packages</name>
<url>https://maven.pkg.github.com/isanteplus/isanteplus-packages</url>
<uniqueVersion>true</uniqueVersion>
</snapshotRepository>
</distributionManagement>
<repositories>
<!-- Use the Github Packages Repo first when looking up dependencies -->
<repository>
<id>github-packages</id>
<name>Github iSantePlus Packages</name>
<url>https://maven.pkg.github.com/isanteplus/isanteplus-packages</url>
</repository>
</repositories>
<build>
<plugins>
<!-- Disable possible test jar generation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<executions>
<execution>
<id>validate</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit 4f9448a

Please sign in to comment.