Skip to content

Ci/publish build artifacts #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 8, 2025
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
1 change: 1 addition & 0 deletions .github/workflows/mvn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on: [push]

jobs:
build:
name: Java ${{ matrix.java }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
Expand Down
29 changes: 21 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
publish:
name: Publish to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -18,20 +19,32 @@ jobs:
with:
submodules: true # Ensure submodules are checked out if needed

- name: Set up JDK 8
- name: Set up JDK 8 and Configure Maven Settings
uses: actions/setup-java@v4
with:
java-version: "8"
distribution: "zulu"
cache: maven
server-id: github # Id of the publication repository field in the pom.xml
settings-path: ${{ github.workspace }} # path for settings.xml with generated authentication info

- name: Configure Maven Settings for GitHub Packages
uses: actions/setup-java@v4
with:
java-version: "8" # Repeat setup to ensure settings are configured
distribution: "zulu"
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Display generated Maven settings.xml for debugging
run: |
echo "Maven settings.xml:"
cat ${{ github.workspace }}/settings.xml || echo "settings.xml not found or empty."
echo "env:"
env

- name: Verify Project Version is not a SNAPSHOT (on release event only)
if: github.event_name == 'release' # Only run this check for actual releases
run: |
PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "Checking project version: $PROJECT_VERSION for release trigger."
if [[ "$PROJECT_VERSION" == *"-SNAPSHOT"* ]]; then
echo "Error: Attempting to deploy a SNAPSHOT version ($PROJECT_VERSION) on a release event. Aborting."
exit 1
fi
echo "Project version $PROJECT_VERSION is a valid release version. Proceeding..."

- name: Publish package
run: mvn --batch-mode deploy -DskipTests=true
Expand Down