Skip to content

Commit

Permalink
OZ-342: Build and Deploy to nexus (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
enyachoke authored Sep 26, 2023
1 parent cb4ee49 commit a2c1641
Show file tree
Hide file tree
Showing 7 changed files with 211 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
npm-debug.log
npm-debug.log
target
src
19 changes: 19 additions & 0 deletions .github/workflows/publish-to-nexus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Validate and optionally publish (if pushed on main)

on:
pull_request:
branches: [main]
push:
workflow_dispatch:

jobs:
build-and-publish:
uses: mekomsolutions/mekom-github-workflow-maven/.github/workflows/build-publish-workflow.yml@main
with:
webhook-url: https://openmrs-cd.mekomsolutions.net/generic-webhook-trigger/invoke
secrets:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
OCD3_USERNAME: ${{ secrets.OCD3_USERNAME }}
OCD3_PASSWORD: ${{ secrets.OCD3_PASSWORD }}
if: ${{ github.ref == 'refs/heads/main' }}
20 changes: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,22 @@ dist
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.pnp.*

target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar

# Eclipse m2e generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
5 changes: 5 additions & 0 deletions .ocd3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: 1
build:
bash_commands: "exit 0"
deploy:
bash_commands: "exit 0"
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
maintenance:
networks:
- web
build: .
image: mekomsolutions/ozone-maintenance-page
environment:
- MESSAGE=${MESSAGE}
- TITLE=${TITLE}
Expand Down
144 changes: 144 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<project>

<modelVersion>4.0.0</modelVersion>
<groupId>com.ozonehis</groupId>
<artifactId>maintenance</artifactId>
<name>Ozone maintenance page</name>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<organization>
<name>Ozone HIS</name>
<url>https://www.ozone-his.com</url>
</organization>
<properties>
<outPut.baseDir>${project.build.directory}/${project.artifactId}-${project.version}</outPut.baseDir>
</properties>
<developers>
<developer>
<name>Mekom Solutions</name>
<url>https://www.mekomsolutions.com</url>
</developer>
</developers>
<dependencies>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<!-- copy -->
<execution>
<id>copy-docker-compose</id>
<phase>package</phase>
<configuration>
<target>
<copy tofile="${outPut.baseDir}/docker-compose.yaml">
<fileset file="${project.basedir}/docker-compose.yaml"/>
</copy>
<copy tofile="${outPut.baseDir}/.env">
<fileset file="${project.basedir}/.env"/>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- packaging the distro as a installable/deployable file -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>package-distro-artifact</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>mks-nexus-public</id>
<url>https://nexus.mekomsolutions.net/repository/maven-public/</url>
</repository>
<repository>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>https://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
</repository>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>https://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>openmrs-snapshots</id>
<name>OpenMRS Public Repository</name>
<url>https://mavenrepo.openmrs.org/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>mks-nexus-public</id>
<url>https://nexus.mekomsolutions.net/repository/maven-public/</url>
</pluginRepository>
<pluginRepository>
<id>mks-nexus-snapshots</id>
<url>https://nexus.mekomsolutions.net/repository/maven-snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

<distributionManagement>
<repository>
<name>Mekom Solutions Nexus repo for releases</name>
<id>mks-nexus-public-releases</id>
<url>https://nexus.mekomsolutions.net/repository/maven-releases</url>
</repository>
<snapshotRepository>
<name>Mekom Solutions Nexus repo for snapshots</name>
<id>mks-nexus-public-snapshots</id>
<url>https://nexus.mekomsolutions.net/repository/maven-snapshots</url>
</snapshotRepository>
</distributionManagement>

</project>
20 changes: 20 additions & 0 deletions src/main/assembly/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd"
>
<id>zip-distro-dir</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<outputDirectory>..</outputDirectory>
<directory>${project.build.directory}/${project.artifactId}-${project.version}</directory>
</fileSet>
</fileSets>
</assembly>

0 comments on commit a2c1641

Please sign in to comment.