Skip to content

ci: prevent CI from deploying release versions unsigned (#421) #768

ci: prevent CI from deploying release versions unsigned (#421)

ci: prevent CI from deploying release versions unsigned (#421) #768

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
branches:
- master
- release/6.0.x
- release/5.0.x
- release/4.0.x
pull_request:
branches:
- master
- release/6.0.x
- release/5.0.x
- release/4.0.x
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: 17
distribution: temurin
cache: maven
server-id: struts2-bootstrap.snapshots
- name: Build
run: mvn -B install
- name: Deploy SNAPSHOT
if: github.ref == 'refs/heads/release/6.0.x' || github.ref == 'refs/heads/release/5.0.x'
run: |
VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)
if [[ "$VERSION" != *-SNAPSHOT ]]; then
echo "⏭️ Version $VERSION is not a SNAPSHOT (release-plugin commit) — skipping deploy"
exit 0
fi
echo "🚀 Deploying $VERSION"
echo "${{ secrets.MAVEN_SETTINGS }}" > ~/.m2/settings-central.xml
mvn -B -DskipTests=true deploy -s ~/.m2/settings-central.xml