Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

mvn -B clean

(mvn org.codehaus.mojo:license-maven-plugin:2.5.0:aggregate-download-licenses &> ./license-maven-plugin.log) &
BKMVNPID="$!"


# Check if parent has PR version and purge if needed
PARENT_VERSION=$(mvn help:evaluate -Dexpression=project.parent.version -q -DforceStdout)
if [[ "$PARENT_VERSION" == *"-PR"* ]]; then
PARENT_GROUP_ID=$(mvn help:evaluate -Dexpression=project.parent.groupId -q -DforceStdout)
PARENT_ARTIFACT_ID=$(mvn help:evaluate -Dexpression=project.parent.artifactId -q -DforceStdout)
echo "~> Parent PR version detected ($PARENT_GROUP_ID:$PARENT_ARTIFACT_ID:$PARENT_VERSION), purging parent dependency cache"
mvn dependency:purge-local-repository \
-DmanualInclude="$PARENT_GROUP_ID:$PARENT_ARTIFACT_ID" \
-DreResolve=false \
-DactTransitively=false
fi


# ~ version set
mvn versions:set -DnewVersion="$ARTIFACT_VERSION"

mvn package;

echo ""
echo "~> Waiting for license download completion"
wait "$BKMVNPID" || true

if grep -q "BUILD SUCCESS" ./license-maven-plugin.log; then
echo "~> License download completed with success"
else
echo "::error::License download terminated with error"
exit 99
fi
20 changes: 20 additions & 0 deletions .github/configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

git config --global advice.detachedHead false

(
cd .github
git clone --depth 1 --branch "${ENTANDO_GITHUB_TOOLS_VERSION}" "https://github.com/entando-ps/github-tools" &>/dev/null
)

. .github/github-tools/lib.sh

configure.start "$1"

if [[ "$GITHUB_REF" == refs/tags/* ]]; then
. .github/github-tools/base.configure --tag "$GITHUB_REF"
else
. .github/github-tools/base.configure "$GH_PR_TITLE" "$GH_PR_NUMBER"
fi

configure.complete
24 changes: 24 additions & 0 deletions .github/publish-nexus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -e

# Validate required environment variables
if [[ -z "$NEXUS_URL" || -z "$NEXUS_REPO_ID" ]]; then
echo "::error::Missing required environment variables: NEXUS_URL or NEXUS_REPO_ID"
exit 1
fi

echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo " PUBLISH TO NEXUS"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

mvn -B javadoc:jar source:jar source:test-jar deploy \
-DskipTests=true \
-DaltDeploymentRepository="${NEXUS_REPO_ID}::${NEXUS_URL}" \
-Pprepare-for-nexus \
-DskipPreDeploymentTests=true \
-DskipPostDeploymentTests=true \
-Ddependency-check.skip=true

echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo " PUBLISH COMPLETE"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
118 changes: 118 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Build and Publish

env:
ENTANDO_GITHUB_TOOLS_VERSION: "v0.1.1"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_PR_TITLE: ${{ github.event.pull_request.title }}
GH_PR_NUMBER: ${{ github.event.pull_request.number }}
GH_PR_RUN_NUMBER: ${{ github.run_number }}
GITHUB_REF: ${{ github.ref }}
JDK_VERSION: '17'

on:
push:
branches: [ "develop", "release/*" ]
tags: [ 'v*' ]
pull_request:
branches: [ "develop", "release/*" ]

jobs:
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# BUILD JOB - Compiles and packages the project
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build:
runs-on: ubuntu-latest
outputs:
SKIP_SCANS: ${{ steps.configure.outputs.SKIP_SCANS }}
SKIP_TESTS: ${{ steps.configure.outputs.SKIP_TESTS }}

permissions:
contents: write
pull-requests: read

steps:
- uses: actions/checkout@v4

- name: Set up JDK ${{ env.JDK_VERSION }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JDK_VERSION }}
distribution: 'temurin'
cache: maven

- name: Configure
id: configure
run: |
if [ -f ".github/configure" ]; then . .github/configure "build"; fi
gh.job.outputVar SKIP_SCANS
gh.job.outputVar SKIP_TESTS

- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-

- name: Build Java
run: .github/build.sh

- name: Submit Dependency Snapshot
if: github.event_name != 'pull_request'
uses: advanced-security/maven-dependency-submission-action@v4

- name: Save build artifacts
uses: actions/upload-artifact@v4
with:
name: build-output
retention-days: 1
path: pom.xml

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# PUBLISH NEXUS JOB - Publishes POM to Nexus
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
publish-nexus:
needs: [build]
if: |
always() &&
needs.build.result == 'success'
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Set up JDK ${{ env.JDK_VERSION }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JDK_VERSION }}
distribution: 'temurin'
cache: maven
server-id: ${{ vars.NEXUS_SERVER_ID }}
server-username: NEXUS_USERNAME
server-password: NEXUS_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Restore build artifacts
uses: actions/download-artifact@v4
with:
name: build-output
path: .

- name: Configure
run: if [ -f ".github/configure" ]; then . .github/configure "publish-nexus"; fi

- name: Publish to Nexus
env:
# Secrets required for authentication (read by Maven settings or script)
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

# Variables required by the bash script
NEXUS_URL: ${{ vars.NEXUS_INSTANCE_URI }}
NEXUS_REPO_ID: ${{ vars.NEXUS_SERVER_ID }}
run: .github/publish-nexus.sh
63 changes: 0 additions & 63 deletions .github/workflows/ga-publication.yml

This file was deleted.

42 changes: 0 additions & 42 deletions .github/workflows/post-merge.yml

This file was deleted.

Loading