From 0fd21898eba592a7990a83fc40257a3a64902c34 Mon Sep 17 00:00:00 2001 From: Samuel Male Date: Tue, 31 Oct 2023 22:56:50 +0000 Subject: [PATCH] Add Github workflows and misc cleanup --- .github/workflows/build-test-deploy.yml | 41 ++++++++++++++++ .github/workflows/build-test.yml | 21 ++++++++ .github/workflows/release.yml | 48 +++++++++++++++++++ .gitignore | 2 + .maven-settings.xml | 64 +++++++++++++++++++++++++ api/pom.xml | 13 +---- omod/pom.xml | 11 +---- pom.xml | 36 +++++++------- 8 files changed, 196 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/build-test-deploy.yml create mode 100644 .github/workflows/build-test.yml create mode 100644 .github/workflows/release.yml create mode 100644 .maven-settings.xml diff --git a/.github/workflows/build-test-deploy.yml b/.github/workflows/build-test-deploy.yml new file mode 100644 index 0000000..89ba179 --- /dev/null +++ b/.github/workflows/build-test-deploy.yml @@ -0,0 +1,41 @@ +name: Build and Deploy + +on: + push: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '8' + + - name: Build and Test + run: mvn --batch-mode --update-snapshots clean package + + - name: Set settings.xml + uses: s4u/maven-settings-action@v2.6.0 + with: + servers: | + [{ + "id": "uwdigi-repo-central", + "username": "${{ secrets.MAVEN_REPO_USERNAME }}", + "password": "${{ secrets.MAVEN_REPO_PASSWORD }}" + }, + { + "id": "uwdigi-repo-snapshots", + "username": "${{ secrets.MAVEN_REPO_USERNAME }}", + "password": "${{ secrets.MAVEN_REPO_PASSWORD }}" + }] + if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'SIGDEP-3' }} + + - name: Deploy + run: mvn --batch-mode clean deploy + if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'SIGDEP-3' }} \ No newline at end of file diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..89f0b6b --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,21 @@ +name: Build and Test + +on: + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '8' + + - name: Build and Test + run: mvn --batch-mode --update-snapshots clean package \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3dba2c2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: HIV_SCREENING Release + +on: + workflow_dispatch: + inputs: + branch: + description: "The branch to checkout when cutting the release." + required: true + default: "main" + releaseVersion: + description: "Default version to use when preparing a release." + required: true + default: "X.Y.Z" + developmentVersion: + description: "Default version to use for new local working copy." + required: true + default: "X.Y.Z-SNAPSHOT" +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Source Code + uses: actions/checkout@v2 + with: + ref: ${{ github.event.inputs.branch }} + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '8' + + - name: Build and Test + run: mvn --batch-mode --update-snapshots clean package + + - name: Configure Git User + run: | + git config user.email "actions@github.com" + git config user.name "GitHub Actions" + + - name: Perform Release + run: mvn release:prepare release:perform -B -s .maven-settings.xml -DreleaseVersion=${{ github.event.inputs.releaseVersion }} -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }} + env: + MAVEN_REPO_USERNAME: ${{ secrets.MAVEN_REPO_USERNAME }} + MAVEN_REPO_PASSWORD: ${{ secrets.MAVEN_REPO_PASSWORD }} + GITHUB_ACTOR: ${{ github.actor }} + GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 082c2a0..9c960a9 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ ### Linux ### .* +!.maven-settings.xml +!.github !.gitignore !.gitattributes *~ diff --git a/.maven-settings.xml b/.maven-settings.xml new file mode 100644 index 0000000..b9f8611 --- /dev/null +++ b/.maven-settings.xml @@ -0,0 +1,64 @@ + + + + + + + + false + + uwdigi-repo-central + libs-release + https://packages.uwdigi.org/artifactory/libs-release + + + + uwdigi-repo-snapshots + libs-snapshot + https://packages.uwdigi.org/artifactory/libs-snapshot + + + + + + false + + uwdigi-repo-central + libs-release + https://packages.uwdigi.org/artifactory/libs-release + + + + uwdigi-repo-snapshots + libs-snapshot + https://packages.uwdigi.org/artifactory/libs-snapshot + + + default + + + + default + + + + ${env.MAVEN_REPO_USERNAME} + ${env.MAVEN_REPO_PASSWORD} + uwdigi-repo-central + + + ${env.MAVEN_REPO_USERNAME} + ${env.MAVEN_REPO_PASSWORD} + uwdigi-repo-snapshots + + + ${env.GITHUB_ACTOR} + ${env.GITHUB_TOKEN} + github + + + + diff --git a/api/pom.xml b/api/pom.xml index 17fc6f7..f4ea035 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -5,7 +5,7 @@ org.openmrs.module hivscreening - 1.0 + 1.0.0-SNAPSHOT hivscreening-api @@ -14,17 +14,6 @@ API project for HivScreeningRegister - - - - - diff --git a/omod/pom.xml b/omod/pom.xml index 7d6a0e2..3f6acce 100644 --- a/omod/pom.xml +++ b/omod/pom.xml @@ -5,7 +5,7 @@ org.openmrs.module hivscreening - 1.0 + 1.0.0-SNAPSHOT hivscreening-omod @@ -15,14 +15,6 @@ - - @@ -30,7 +22,6 @@ ${project.parent.artifactId}-api ${project.parent.version} - diff --git a/pom.xml b/pom.xml index 5f3319c..7235b66 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.openmrs.module hivscreening - 1.0 + 1.0.0-SNAPSHOT pom Hiv Screening Register Module Screening HIV module for client screening results @@ -22,10 +22,11 @@ - scm:svn:https://svn.openmrs.org/openmrs-modules/hivscreening/trunk/ - scm:svn:https://svn.openmrs.org/openmrs-modules/hivscreening/trunk/ - https://svn.openmrs.org/openmrs-modules/hivscreening/trunk/ - + scm:git:https://github.com/SIGDEP-3/openmrs-module-hivscreening.git + scm:git:https://github.com/SIGDEP-3/openmrs-module-hivscreening.git + scm:git:https://github.com/SIGDEP-3/openmrs-module-hivscreening.git + HEAD + api @@ -40,19 +41,6 @@ - - - - @@ -171,4 +159,16 @@ + + + uwdigi-repo-central + libs-release + https://packages.uwdigi.org/artifactory/libs-release + + + uwdigi-repo-snapshots + libs-snapshot + https://packages.uwdigi.org/artifactory/libs-snapshot + +