diff --git a/.github/workflows/clean-pages.yml b/.github/workflows/clean-pages.yml new file mode 100644 index 0000000..5c96028 --- /dev/null +++ b/.github/workflows/clean-pages.yml @@ -0,0 +1,36 @@ +name: Clean Pages + +on: delete +env: + TZ: America/Indianapolis + +jobs: + clean-site: + runs-on: [ Linux ] + container: + image: registry.docker.iu.edu/eshr-architecture/ess-build:latest + credentials: + username: ${{ secrets.ESHR_REGISTRY_USERNAME }} + password: ${{ secrets.ESHR_REGISTRY_PASSWORD }} + + steps: + - uses: actions/checkout@v3 + with: + ref: github_pages + + - name: Unpublish Docs + run: | + ref=${{ github.event.ref }} + pwd + ls -ld . docs docs/$ref + git config --global --add safe.directory $PWD + if [ -d docs/$ref ] + then + git config user.name eshrastg + git config user.email ess-dev-l@iu.edu + git rm -r docs/$ref + git commit -m "clean $ref" + git push + else + echo "Nothing to do for $ref" + fi diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml new file mode 100644 index 0000000..e4fa08d --- /dev/null +++ b/.github/workflows/develop.yml @@ -0,0 +1,81 @@ +# Description +# ----------- +# This workflow is intended to run anytime there is a push on a `develop` branch. + +name: Develop Branch + +on: + push: + branches: + - develop* + workflow_dispatch: + +env: + TZ: America/Indianapolis + +jobs: + deploy: + if: ( github.event_name == 'workflow_dispatch' || github.event_name == 'push' ) && startsWith(github.ref, 'refs/heads/develop') + name: Verify and Deploy Maven Project + runs-on: [ Linux ] + container: + image: registry.docker.iu.edu/eshr-architecture/ess-build:latest + credentials: + username: ${{ secrets.ESHR_REGISTRY_USERNAME }} + password: ${{ secrets.ESHR_REGISTRY_PASSWORD }} + volumes: + - /opt/actions/cache/m2/repository:/root/.m2/repository + + steps: + - name: Clone GitHub repository + uses: actions/checkout@v3 + + - name: Generate build time configuration + env: + ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT }} + ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT }} + ESSBUILD_VAULT_APPROLE_ROLE_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_STG }} + ESSBUILD_VAULT_APPROLE_SECRET_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_STG }} + ESSBUILD_VAULT_APPROLE_ROLE_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_REG }} + ESSBUILD_VAULT_APPROLE_SECRET_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_REG }} + run: | + generate_build_properties + generate_deploy_properties + + - name: Compile, Verify, and Build Javadoc + id: verify + run: | + mvn clean verify -U --batch-mode + + - name: Deploy Artifacts + run: | + mvn deploy -DskipTests --batch-mode + + - name: Publish Documentation + if: steps.verify.outcome == 'success' + run: | + git config --global --add safe.directory $PWD + if (git fetch origin github_pages) + then + git checkout github_pages + else + git checkout -b github_pages + git push --set-upstream origin github_pages + fi + git pull + rm -rf docs/$GITHUB_REF_NAME + mkdir -p docs/$GITHUB_REF_NAME + for a in $(find -type d -regex '.*/\(apidocs\|jacoco\(-aggregate\)?\)' | cut -b3- | egrep -v '^docs/') + do + t=docs/$GITHUB_REF_NAME/${a%%target*} + mkdir -p $t + mv $a $t + done + if (git add docs && git commit --dry-run) + then + git config user.name eshrastg + git config user.email ess-dev-l@iu.edu + git commit -m "publish $GITHUB_ACTOR $GITHUB_REF_NAME" + git push + fi + diff --git a/.github/workflows/ephemeral-branch.yml b/.github/workflows/ephemeral-branch.yml new file mode 100644 index 0000000..9aa74d8 --- /dev/null +++ b/.github/workflows/ephemeral-branch.yml @@ -0,0 +1,84 @@ +# Description +# ----------- +# This workflow is intended to run anytime there is a push on a `feature` +# branch, or when a pull request is opened on a `feature`. Ephemeral branches +# follow the format `feature/`. This workflow is intended to verify build and push API documentation. During workflow execution the branch will +# be marked pending to prevent it from being merged. It must also complete successfully for the +# job to be marked a success, therefore allowing the branch to be merged. + +name: Ephemeral Branch + +on: + push: + branches: + - feature/** + workflow_dispatch: + +env: + TZ: America/Indianapolis + +jobs: + verify: + if: ( github.event_name == 'workflow_dispatch' || github.event_name == 'push' ) && startsWith(github.ref, 'refs/heads/feature/') + name: Build and Verify Feature Branch + runs-on: [ Linux ] + container: + image: registry.docker.iu.edu/eshr-architecture/ess-build:latest + credentials: + username: ${{ secrets.ESHR_REGISTRY_USERNAME }} + password: ${{ secrets.ESHR_REGISTRY_PASSWORD }} + volumes: + - /opt/actions/cache/m2/repository:/root/.m2/repository + + steps: + - name: Clone GitHub repository + uses: actions/checkout@v3 + + - name: Generate build time configuration + env: + ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT }} + ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT }} + ESSBUILD_VAULT_APPROLE_ROLE_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_STG }} + ESSBUILD_VAULT_APPROLE_SECRET_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_STG }} + ESSBUILD_VAULT_APPROLE_ROLE_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_REG }} + ESSBUILD_VAULT_APPROLE_SECRET_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_REG }} + run: | + generate_build_properties + + - name: Compile and Build Javadoc + id: compile + run: | + mvn clean verify -DskipTests -U --batch-mode + + - name: Verify Test Coverage + run: | + mvn verify -Dmaven.javadoc.skip --batch-mode + + - name: Publish Documentation + if: steps.compile.outcome == 'success' + run: | + git config --global --add safe.directory $PWD + if (git fetch origin github_pages) + then + git checkout github_pages + else + git checkout -b github_pages + git push --set-upstream origin github_pages + fi + git pull + rm -rf docs/$GITHUB_REF_NAME + mkdir -p docs/$GITHUB_REF_NAME + for a in $(find -type d -regex '.*/\(apidocs\|jacoco\(-aggregate\)?\)' | cut -b3- | egrep -v '^docs/') + do + t=docs/$GITHUB_REF_NAME/${a%%target*} + mkdir -p $t + mv $a $t + done + if (git add docs && git commit --dry-run) + then + git config user.name eshrastg + git config user.email ess-dev-l@iu.edu + git commit -m "publish $GITHUB_ACTOR $GITHUB_REF_NAME" + git push + fi + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..b14498f --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,79 @@ +# Description +# ----------- +# This workflow is intended to run to deploy release from main branch. +# It must be executed manually. + +name: Main Branch + +on: + workflow_dispatch: + +env: + TZ: America/Indianapolis + +jobs: + deploy: + if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' + name: Verify and Deploy Maven Project + runs-on: [ Linux ] + container: + image: registry.docker.iu.edu/eshr-architecture/ess-build:latest + credentials: + username: ${{ secrets.ESHR_REGISTRY_USERNAME }} + password: ${{ secrets.ESHR_REGISTRY_PASSWORD }} + volumes: + - /opt/actions/cache/m2/repository:/root/.m2/repository + + steps: + - name: Clone GitHub repository + uses: actions/checkout@v3 + + - name: Generate build time configuration + env: + ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT }} + ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT }} + ESSBUILD_VAULT_APPROLE_ROLE_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_STG }} + ESSBUILD_VAULT_APPROLE_SECRET_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_STG }} + ESSBUILD_VAULT_APPROLE_ROLE_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_REG }} + ESSBUILD_VAULT_APPROLE_SECRET_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_REG }} + run: | + generate_build_properties + generate_deploy_properties + + - name: Compile, Verify, and Build Javadoc + id: verify + run: | + mvn clean verify -U --batch-mode + + - name: Deploy Artifacts + run: | + mvn deploy -DskipTests --batch-mode + + - name: Publish Documentation + if: steps.verify.outcome == 'success' + run: | + git config --global --add safe.directory $PWD + if (git fetch origin github_pages) + then + git checkout github_pages + else + git checkout -b github_pages + git push --set-upstream origin github_pages + fi + git pull + rm -rf docs/$GITHUB_REF_NAME + mkdir -p docs/$GITHUB_REF_NAME + for a in $(find -type d -regex '.*/\(apidocs\|jacoco\(-aggregate\)?\)' | cut -b3- | egrep -v '^docs/') + do + t=docs/$GITHUB_REF_NAME/${a%%target*} + mkdir -p $t + mv $a $t + done + if (git add docs && git commit --dry-run) + then + git config user.name eshrastg + git config user.email ess-dev-l@iu.edu + git commit -m "publish $GITHUB_ACTOR $GITHUB_REF_NAME" + git push + fi + diff --git a/pom.xml b/pom.xml index 439b2a3..10d2eee 100755 --- a/pom.xml +++ b/pom.xml @@ -5,8 +5,8 @@ edu.iu.util - iu-parent - 7.0.0 + iu-java-parent + 7.0.0-SNAPSHOT