From 8580cc6c4edb0eec2bfc3da45a9b679a85ad3f97 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 12 Oct 2026 04:17:52 +0000 Subject: [PATCH] Add Gitea workflow publishing the library to the public Maven registry - .gitea/workflows/publish.yml: build, test and deploy on push to main (snapshot), on v* tags (release version from the tag) and manually; authenticates with the REGISTRY_TOKEN secret - demo app is excluded from deployment - pin maven-deploy-plugin and versions-maven-plugin - README: how to consume the package Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G71TQ5jDETVwdUJxGAwaiT --- .gitea/workflows/publish.yml | 46 ++++++++++++++++++++++++++++++++++++ README.md | 23 ++++++++++++++++++ mailsender-demo/pom.xml | 5 ++++ pom.xml | 10 ++++++++ 4 files changed, 84 insertions(+) create mode 100644 .gitea/workflows/publish.yml diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml new file mode 100644 index 0000000..ad7b7a3 --- /dev/null +++ b/.gitea/workflows/publish.yml @@ -0,0 +1,46 @@ +# Builds, tests and publishes the library modules (parent, core, autoconfigure, starter) to the Gitea Maven +# registry of the "public" owner. The demo app is not published. +# +# push to main -> -SNAPSHOT from pom.xml +# tag v1.2.3 -> release 1.2.3 +# manual run -> whatever pom.xml says +# +# Needs the repository/organization secret REGISTRY_TOKEN: a Gitea access token with "write:package" scope. +name: Publish + +on: + push: + branches: [main] + tags: ['v*'] + workflow_dispatch: + +env: + REGISTRY_URL: ${{ gitea.server_url }}/api/packages/public/maven + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '27' + cache: maven + # writes ~/.m2/settings.xml with a reading these env vars + server-id: gitea + server-username: REGISTRY_USERNAME + server-password: REGISTRY_TOKEN + + - 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 + env: + GITEA_REF_NAME: ${{ gitea.ref_name }} + + - name: Build, test and publish + run: mvn -B -ntp deploy -DaltDeploymentRepository="gitea::${REGISTRY_URL}" + env: + REGISTRY_USERNAME: ${{ gitea.actor }} + REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} diff --git a/README.md b/README.md index fb5bf3a..a1e6b0f 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,29 @@ mvn verify | `mailsender-pgp-spring-boot-starter` | dependency bundle for applications | | `mailsender-demo` | sample app that sends test mails | +## Installation + +Releases and snapshots are published to the Gitea Maven registry of the `public` owner by +`.gitea/workflows/publish.yml` (push to `main` → `-SNAPSHOT`, tag `v1.2.3` → `1.2.3`): + +```xml + + + gitea-public + https://YOUR-GITEA-HOST/api/packages/public/maven + + + + + pro.thinhha.mailsender + mailsender-pgp-spring-boot-starter + 0.1.0 + +``` + +If the packages are not public, add a `` with id `gitea-public` and a token with `read:package` scope to +your `settings.xml`. + ## Usage Add `pro.thinhha.mailsender:mailsender-pgp-spring-boot-starter`, configure `spring.mail.*` as usual, and send diff --git a/mailsender-demo/pom.xml b/mailsender-demo/pom.xml index cc230cb..b9ffab1 100644 --- a/mailsender-demo/pom.xml +++ b/mailsender-demo/pom.xml @@ -13,6 +13,11 @@ mailsender-demo Demo app: looks up the recipient's WKD key and sends test e-mails + + + true + + pro.thinhha.mailsender diff --git a/pom.xml b/pom.xml index 037f2dc..fe87406 100644 --- a/pom.xml +++ b/pom.xml @@ -93,6 +93,16 @@ maven-surefire-plugin 3.5.3 + + org.apache.maven.plugins + maven-deploy-plugin + 3.1.4 + + + org.codehaus.mojo + versions-maven-plugin + 2.18.0 +