diff --git a/.github/workflows/develop-build.yml b/.github/workflows/develop-build.yml new file mode 100644 index 0000000..43a0c52 --- /dev/null +++ b/.github/workflows/develop-build.yml @@ -0,0 +1,48 @@ +name: Publish Development Build + +permissions: + contents: write + +on: + push: + branches: + - 'develop' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out source code + uses: actions/checkout@v4 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Set up Maven cache + uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Build with Maven + run: mvn clean verify -U + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')" + - name: Create tag name from date + id: tagdate + run: echo "::set-output name=tagdate::$(date +'%Y-%m-%d_%H-%M-%S_%Z')" + - name: Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + name: ${{ steps.date.outputs.date }} + tag_name: ${{ steps.tagdate.outputs.tagdate }} + generate_release_notes: true + draft: false + prerelease: true + files: | + **/target/*.jar + install/* + \ No newline at end of file diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml new file mode 100644 index 0000000..9e8a022 --- /dev/null +++ b/.github/workflows/release-build.yml @@ -0,0 +1,48 @@ +name: Publish Release Build + +permissions: + contents: write + +on: + push: + branches: + - 'master' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out source code + uses: actions/checkout@v4 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Set up Maven cache + uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Build with Maven + run: mvn clean verify -U + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')" + - name: Create tag name from date + id: tagdate + run: echo "::set-output name=tagdate::$(date +'%Y-%m-%d_%H-%M-%S_%Z')" + - name: Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + name: ${{ steps.date.outputs.date }} + tag_name: ${{ steps.tagdate.outputs.tagdate }} + generate_release_notes: true + draft: false + prerelease: false + files: | + **/target/*.jar + install/* + \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 7122941..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Build and upload to release - -on: - push: - branch: - - 'master' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Check out source code - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Set up Maven cache - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Build with Maven - run: mvn package --file plugin/pom.xml -DskipTests - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')" - - name: Create tag name from date - id: tagdate - run: echo "::set-output name=tagdate::$(date +'%Y-%m-%d_%H-%M-%S_%Z')" - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.tagdate.outputs.tagdate }} - release_name: ${{ steps.date.outputs.date }} - draft: false - prerelease: false - - name: Upload main asset - id: upload-main-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: plugin/module-main/target/plugin_intranda_workflow_processInspection.jar - asset_name: plugin_intranda_workflow_processInspection.jar - asset_content_type: application/jar - - name: Upload GUI asset - id: upload-gui-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: plugin/module-gui/target/plugin_intranda_workflow_processInspection-GUI.jar - asset_name: plugin_intranda_workflow_processInspection-GUI.jar - asset_content_type: application/jar \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 37bbe3a..4d103f4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,16 +43,33 @@ pipeline { } } - stage('deploy-libs') { + stage('deploy-snapshot-libs') { when { anyOf { - branch 'master' branch 'develop' } } steps { script { if (fileExists('module-lib/pom.xml')) { + sh 'cat pom.xml | grep "SNAPSHOT"' + sh 'mvn -N deploy' + sh 'mvn -f module-lib/pom.xml deploy' + } + } + } + } + + stage('deploy-release-libs') { + when { + anyOf { + branch 'master' + } + } + steps { + script { + if (fileExists('module-lib/pom.xml')) { + sh 'cat pom.xml | grep "SNAPSHOT" || true' sh 'mvn -N deploy' sh 'mvn -f module-lib/pom.xml deploy' } @@ -63,7 +80,7 @@ pipeline { post { always { - junit "**/target/surefire-reports/*.xml" + junit allowEmptyResults: true, testResults: "**/target/surefire-reports/*.xml" step([ $class : 'JacocoPublisher', execPattern : '**/target/jacoco.exec', diff --git a/plugin_intranda_workflow_processinspection.xml b/install/plugin_intranda_workflow_processinspection.xml similarity index 100% rename from plugin_intranda_workflow_processinspection.xml rename to install/plugin_intranda_workflow_processinspection.xml