Use the Maven Wrapper in the Gitea workflow and check the registry token

act-based Gitea runner images do not ship Maven, so the publish job failed
with 'mvn: command not found'. Add the Maven Wrapper (Maven 3.9.11) and use
./mvnw. Fail early with a clear message when REGISTRY_TOKEN is not available.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G71TQ5jDETVwdUJxGAwaiT
This commit is contained in:
Claude committed 2026-10-12 06:55:08 +00:00
1 parent 8580cc6c4e
commit b91a5f485c
5 files changed
+442 -5

No files matched your search

+12 -2
View File
@@ -6,6 +6,7 @@
# manual run -> whatever pom.xml says
#
# Needs the repository/organization secret REGISTRY_TOKEN: a Gitea access token with "write:package" scope.
# Uses the Maven Wrapper (./mvnw): act-based runner images do not ship Maven.
name: Publish
on:
@@ -21,6 +22,15 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check registry token
env:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
if [ -z "$REGISTRY_TOKEN" ]; then
echo "::error::Secret REGISTRY_TOKEN is not set or not available to this repository (Settings > Actions > Secrets)."
exit 1
fi
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
@@ -35,12 +45,12 @@ jobs:
- name: Set release version from tag
if: startsWith(gitea.ref, 'refs/tags/v')
run: mvn -B -ntp versions:set -DnewVersion="${GITEA_REF_NAME#v}" -DgenerateBackupPoms=false
run: ./mvnw -B -ntp versions:set -DnewVersion="${GITEA_REF_NAME#v}" -DgenerateBackupPoms=false
env:
GITEA_REF_NAME: ${{ gitea.ref_name }}
- name: Build, test and publish
run: mvn -B -ntp deploy -DaltDeploymentRepository="gitea::${REGISTRY_URL}"
run: ./mvnw -B -ntp deploy -DaltDeploymentRepository="gitea::${REGISTRY_URL}"
env:
REGISTRY_USERNAME: ${{ gitea.actor }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}